Save GUI as executable file

1 次查看(过去 30 天)
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 !

采纳的回答

Walter Roberson
Walter Roberson 2011-12-24
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.

更多回答(3 个)

Fangjun Jiang
Fangjun Jiang 2011-12-24
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 2011-12-24
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 个评论
Walter Roberson
Walter Roberson 2011-12-24
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.

请先登录,再进行评论。


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

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by