make GUI to exe file
3 views (last 30 days)
Show older comments
Hi, I create a GUI file in Matlab. It work truly, but when I make it in exe format by 'deploytool". I face a problem. I have .mat file and it is the file which my program add data by "save" and "load", but when it is in exe format, .mat fileremain empty and any add recored is not done.
3 Comments
Walter Roberson
on 21 Sep 2013
Could it be an issue with which directory you are writing in? How is the directory chosen?
Answers (4)
Image Analyst
on 11 Sep 2013
Call them. I've never experienced that before - where the compilation process, or the installation process, totally empties out a mat file. Sounds very weird so it could be that you are not adding the mat file you think you are, or your code deletes existing mat file and creates a new empty one.
0 Comments
mitra
on 21 Sep 2013
1 Comment
Image Analyst
on 21 Sep 2013
I don't know what "work bably" means. See the FAQ if your compiled program doesn't work properly. http://matlab.wikia.com/wiki/FAQ#MATLAB_Compiler_Toolbox
Walter Roberson
on 21 Sep 2013
In an .exe, using
save('MyDatabse','MyDatabse');
means to save the object into whatever directory the executable happens to be in, which by default would be the temporary directory the executable unpacked itself into. The default directory for executables will not be the directory that the user was somehow "in" when the user clicked on the icon to start the program.
See the documentation for ctfroot()
1 Comment
Image Analyst
on 21 Sep 2013
I think Walter is right. It's a very common blunder for people to not specify the folder for files. So you were probably reading in a .mat file in the same file as your executable, changing it, and writing it out, and then looking at your original file and saw no change but did not realize that the file that got changed was the one in the secret special folder, not the one where the executable was. Did deploytool read in the mat file in the secret folder, and write to the same one or not??? Who knows, so that's why I always make a special effort to specify folders so I KNOW where it's getting the files from and not rely on ctfroot or wherever the current folder happens to be.
See Also
Categories
Find more on Workspace Variables and MAT-Files in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!