Save GUI as executable file

조회 수: 1 (최근 30일)
Maryam Emad
Maryam Emad 2011년 12월 24일
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
  댓글 수: 1
Maryam Emad
Maryam Emad 2011년 12월 24일
Pleas explain more !

댓글을 달려면 로그인하십시오.


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