Save GUI as executable file

1 view (last 30 days)
Maryam Emad
Maryam Emad on 24 Dec 2011
I made a GUI and saved the .m and .fig file in the work directory. thus I wrote the command [mcc -mv filename.m] in the command window. It generates a filename.exe file. this file is executable.
But it doesnot run in a machine where matlab has not setup. Now i want to make an application that will run in any in any machine independent of Matlab… is it possible?
Other thing , My GUI contain some button in order to load '*.dat 'file. All things are good except this button , its show an error to load this file !

Accepted Answer

Walter Roberson
Walter Roberson on 24 Dec 2011
It is not possible to create an application that will run in any machine independent of MATLAB. All that is supported is creating applications that can run under MS Windows XP or later, or under Linux, or under Mac OS X. Different versions are required for Windows 32, Windows 64, Linux, and OS X. There is no Universal Binary.

More Answers (3)

Fangjun Jiang
Fangjun Jiang on 24 Dec 2011
You have to install the MCR on that machine that doesn't have the MATLAB. The easiest way to do it is to run deploytool. It helps you to package all the files that are needed for deployment.
doc deploytool

Image Analyst
Image Analyst on 24 Dec 2011
See the FAQ:
Your files don't load because your executable is not your real executable - it's really a self extracting program that unloads your real executable to some other folder and runs it from there. Your files are NOT there and so it doesn't find them. You can verify this fact by putting this command in your startup code;
fprintf('ctfroot = %s\n', ctfroot);
Then look in the console window to see what folder got printed out. ctfroot is where your real executable is and you'll see it's not where you thought it was. You probably shipped your data files and put them in the place where the executable is, but like I said, that's not the real executable. To fix the situation, make sure you set your folder to where you know your files live, then construct the file name and check for its existence like this example:
folder = fullfile(matlabroot, '\toolbox\images\imdemos'); % or wherever
baseFileName = 'peppers.png';
fullFileName = fullfile(folder, baseFileName);
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName);
if ~exist(fullFileName, 'file')
% Didn't find it there. Check the search path for it.
fullFileName = baseFileName; % No path this time.
if ~exist(fullFileName, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
  1 Comment
Walter Roberson
Walter Roberson on 24 Dec 2011
Also, you can use the -a option (or use deploytool) to bundle files that will be extracted into ctfroot; then you can use ctfroot as the location to extract them from.

Sign in to comment.


Jan Stolarek
Jan Stolarek on 24 Dec 2011
Regarding the problems with loading file: what error exactly do you get? Perhaps there is an error in path to the file?

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!