Accessing any folder from a compiled MATLAB application - matlab

I am developing a windows stand alone application in MATLAB 2012b .
In the code I am writing some files in two folders images and dump which are both accessible to the user. I want those two folders to be in the same folder as the final executable. I can create those folders manually. However, when I run the compiled application, it does not seem to access those folders. For example, the following line of code works perfectly when run from inside MATLAB,
save(fullfile('./images/camp.mat'),'camp','-v7.3');
however it does not seem to work in GUI as it seems to stop working at that point only and nothing is created in the images folder.
I have searched through the internet and found things like ctfroot() and MCR_ROOT etc but I am not able to solve my problem.

Related

Problems with adding NetLogo extension for Mac

I'm having a problem adding the matlab-extension folder previously developed (https://github.com/mbi2gs/netlogo-matlab-extension/wiki) into the net logo extension folder. I think there is some problem with my ability to write into the NetLogo folders. I have tried troubleshooting with erasing and rewriting the drive, and by checking the 'ignore ownership on this volume' in the get info box. But neither of these have helped adding files into NetLogo. My system is macOS Sierra v. 10.12.6 and NetLogo 6.1.1.
At the moment I don't have MatLab installed, but here are a few things you could try.
It looks like you are running NetLogo from inside the disk image (dmg file) it came in. This might work, but generally I'd advise copying the NetLogo 6.1.1 folder out of the disk image into your Applications folder and getting rid of the disk image entirely. You can either open the the NetLogo disk image and the Applications folder at the same time then drag the NetLogo 6.1.1 folder over, or you can select the NetLogo 6.1.1 folder and Command-C to copy then Command-V to paste the folder to the Applications.
The second step is to make you sure you have the matlab folder copied into the extensions folder under the NetLogo 6.1.1 folder, per those MatLab extension directions.
If the Matlab extension does write to the NetLogo folder while it's running, you may have to repeat those steps you tried to give your user read and write access to the NetLogo 6.1.1 folder, too.
Here is a pic of how things look with my NetLogo 6.1.1 folder in the Applications folder and the matlab extension copied in.
If none of that helps, one alternative to try is to place the contents of the matlab extension folder in a new folder inside your Documents folder, something like matlab-models. Then if you place an nlogo model file there and load it, NetLogo should use this matlab-models folder's copy of the extension, and you'll definitely have proper permission to write to it in your Documents folder. You want the matlab.jar file right alongside the nlogo models you use Matlab with if you try this.

Prevent VS Code from opening all files in a folder recursively

I am currently using VS Code on a folder mounted through an SSHFS. The folder has subfolders with many jpg and other image files.
Logging all the files VS Code tries to open reveals it recursively touches all the files (doesn't read the content, just STATs them). This takes very, very long over an SSHfs mount and I can not cancel it without killing the editor (it won't even respond to regular closing).
During this, no files or directories can be opened (inside VSCode) and will show a loading spinner until VS Code has finally had it's way and checked all the files.
This behaviour only recently emerged, I can't pinpoint if any version beyond the current stable version has this behaviour.
I am thinking it might be the new searching engine, but I can't find out which part of the editor is doing it.
It looks like they just posted a fix for your situation:
Slow startup opening a large workspace over the network
you will need vscode v1.32.3

Trouble with FilePickers in Unity Hololens development

I found a terrific reference on how to get started with file pickers. But with that being said, I am not able to get the provided code working for my Unity Hololens app.
My scenario:
I've a file, lets say an object file, like such, 3DModel.obj. I want my app to be able to locate this file (3DModel.obj) at runtime, and then load it at runtime.
I'm attempting to use these read/write functions but I'm getting no where. I've run through numerous functions such as, Windows.Storage.ApplicationData.Current.RoamingFolder, KnownFolder, LocalFolder, dataPath, persistentDataPath.
I've perused through Microsofts file picker documentation, and I'm still left scratching my head.
None of these seem to accomplish what I'm trying to do, or my ineptitude and lack of knowledge on how to use file pickers fails to get the job done.
Limitations of the HoloLens shell:
File Explorer and Local File System
The Windows Holographic app model does not currently expose the concept of a file system. There are known folders, but there is no built in, local File Explorer app like on Windows Desktop or Mobile. Apps can save files to their local state folders. Apps can also save files to a registered File Picker app like OneDrive.

Error on a .exe that was running perfectly before being compiled

guys,
I just finished a particular code in MATLAB R2014a that reads and write into multiple text files and saves an image inside the same folder of the script. The script runs perfectly, but the compilation executable does not, so I believe that it has something to do with the PATH that the executable is trying to use to run, I don't really know.
The error was the folllowing:
That's the second read function in the code that tries to read a file and it's possible to see that the code was already successful doing a read/write operation, since a .txt is created.
Just to keep it simple, I didn't use any global paths to the files and tried to keep them inside of the script and executable folder.
I don't have a lot of experience compiling stuff, so I just used deploytool and hit run to test it, so I would love to hear some insights about the possible cause of the problem.
Thank you in advance for the help!
MATLAB doesn't include every file on your PATH when it compiles. It tries to detect additional files that may be accessed when running the code in your application's main file, and include those in the compilation, but it isn't always 100% successful (I'm not sure exactly what conditions it's unable to detect).
After you have run the deploytool once, the full list of files it has detected in this way will be listed under Files required for your application to run. You can add files to this list (whether or not your project has already been compiled) using the "+" icon in the corner of that section.

Manually Adding Toolbox to Matlab R2013b

I am working with OS X version 10.9.4 and using Matlab R2013b. I have recently downloaded a toolbox file and it saved as a folder on my desktop. It contains a bunch of .m files, which I'm not really sure how to add into my Matlab. I've read online and watched a few tutorials that all mention that I need to set the path to Matlab, but I can't seem to get it to work for me. I'm very new to Matlab and have been trying to figure this out for a couple of days, so my apologies if this is a very simple question to be asking.
There are a couple of ways of doing this. When a function is called in Matlab, it will look in all the directories contained within the path to find it. You can bring up the path by typing in the command "path".
Presumably, you want to add a new location for Matlab to look. This can be done via the addpath command. Addpath accepts both relative and absolute addresses. For example the command
addpath('C:\My_Matlab_Functions')
will enable you to access functions & files within the folder My_Matlab_Functions.
Relative directories are taken relative to the file which calls addpath. For example if I am running a function within C:\users\user_name\My_Documents\Matlab, calling
addpath('Tools')
will enable you to access all of the files within C:\users\user_name\My_Documents\Matlab\Tools. You can also go up directories via '..'. For example, if I am running a function within C:\users\user_name\My_Documents\Matlab\Project1, the command
addpath('..\Tools')
Accesses the same tools folder as before.
I have tried these examples on Windows, but I presume they work the same on a Mac. Hope this helps.
Alternatively, you may be able to add your file(s) directly into Matlab's built in toolbox. I don't know whether Matlab automatically searches for new folders here, but it may be worth a shot.