This video shows how to use DEPLOYTOOL to create a project and compile it so that it can be used outside of MATLAB, meaning you can give it to someone that does not own MATLAB and they can still run it.
This is useful in a variety of situations, for example you might want to lock down a functioning GUI so that even as you upgrade MATLAB you will know that your GUI will not change, because it is a stand alone. You might want to obscure your algorithms from people you give your code to.
The demonstration is using an add on product called: MATLAB compiler
http://www.mathworks.com/products/compiler/
Very useful guide. But when I went to the deployment tool, “windows Standalone application” was not one of the options. Also, when I tried to run the deployment tool on a GUI i created, it asked which compiler I wanted to use. Is there a specific one that needs to be used? Also, how do you generate and send out the MCR file that you discussed? Thanks!
The MATLAB Compiler deployment target “Windows Standalone Application” was new with MATLAB R2007b. Older versions only had the “Standalone Application” option - the difference being the new Windows Standalone Application does not start a command console (dos box).
You can include the MATLAB Component Runtime (MCR) with your MATLAB Compiler generated executable by using the packaging feature of deploytool. By default the MCR is not included with the executable because of its size. However, if you go into the deploytool settings, under packaging, you can optionally choose to include it. This tab will also show you where the MCR is located on your file system if you want to distribute it separately.
they can give you details on how to do this. You might even be able to upgrade to the newest version of MATLAB, depending on what you company has purchased.
I have R2007a ,and I want make some wavelet function to COM,and use the COM in Visual Basic,but I have tried many times,all lost.Could you give me some suggestion?Thanks.
function xiaobo
n=[1:50];
x=sin(pi/10*n+pi/3)+2*cos(pi/7*n);
w=randn(1,length(n));
y=x+w;
subplot(3,1,1);
plot(x);
subplot(3,1,2);
plot(y);
xd=wden(y,’minimaxi’,’s’,'one’,5,’db3′);
subplot(3,1,3);
plot(xd);
title(’ok’);
grid;
This function work well in matlab.
I try to use mcc -vm xiaobo.m to gain a application, but throw
following errors
size of your application. Please wait…
…CTF archive extraction complete.
??? Index exceeds matrix dimensions.
Error in ==> wtbxmngr at 75
Error in ==> dwtmode at 158
Error in ==> dwt at 54
Error in ==> wavedec at 43
Error in ==> wden at 62
Error in ==> xiaobo at 10
MATLAB:badsubscript
Warning: 1 visible figure(s) exist at MCR termination.
did the mcc compiler support wavelet function well?
did the matlab builder for .net support wavelet function well?
please help me? thanks
I am trying to just run the magicsquare.m file to creat stand alone execytable. But when I try to run the exe file it says ” This application has failed to start because mclmcrrt77.dll was not found. Re-installing the application may fix this problem”.
Can you please suggest the possible reason. I am remotely using the matlab from a server.
very nice show!
But i am not being able to access the deployment tool.
I’ve written deploytool and pressed enter. But it replays me undefined function…
So, what to do… i must be greatful to you…
I have seen this video more than 20 times but not getting the answer how to access the deploytool?
Please help me!
My Matlab version is 7.1
Is it a problem for not finding Deploument Tool?
please answer me as soon as possible… i am in a big trouble!
Also, if you do have MATLAB Compiler, “deploytool” was added to the product in R2006b. If you have an older version of the MATLAB Compiler, you need to use the command line functionality (mcc).
Thanks! for reply…
It will be my pleasure if you give me the answer of following…
I made a GUI and saved the m.file in the work directory. thus wrote the command [mcc -mv filename.m] in the command window.
It generates a filename.exe file. this file is executabe.
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?
Which version of MATLAB are you using? Does the .exe file run successfully on the same computer?
You have to install the MCR on machines that do not have MATLAB. Take a look at the documentation for MATLAB Compiler (there might be a section called “Deployment Process”)
If you are having more problems, I suggest you contact support:
Your video is excellent. I’m using Matlab R2008a and have a problem. I used the deploytool and compiled a program I’m coding for Line Codes. It uses 2 .fig GUIs and 4 .m files (2 for figures and 2 as support for the figures). The 2 GUIs are the splash screen (with my name on it) and the main screen. So on the deploytool I put, as main function, the splash.m file. Then I compiled.
The program runs great in MATLAB, but the exe file seems to open and close really fast (not showing anything). If I compile using mcc -e, the program works but I cannot run it in other non MATLAB computers. I also saw that MCR Installer is at “C:\MATLAB\toolbox\compiler\deploy\win32\” Can I take that installer to other computers, run it and then run my program compiled using mcc -e? Or do I need to package it using deploytool? Why is my program not working with deploytool?
I have got exactly the same issue as Julio. Please help!
I even tried waitforcallbacks(true) in the GUIopening function but still
Can you please tell which compiler you use?
Thanks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
If your application has terminated unexpectedly, please note that
applications generated by the MATLAB Compiler terminate when there are no
visible figure windows. See the documentation for WaitForFiguresToDie and
WAITFORCALLBACKS for more information.
Warning: Class
‘uitools.uimodemanager’
in use at MCR termination.
If your application has terminated unexpectedly, please note that
applications generated by the MATLAB Compiler terminate when there are no
visible figure windows. See the documentation for WaitForFiguresToDie and
WAITFORCALLBACKS for more information.
Warning: Class
‘uitools.uimode’
in use at MCR termination.
If your application has terminated unexpectedly, please note that
applications generated by the MATLAB Compiler terminate when there are no
visible figure windows. See the documentation for WaitForFiguresToDie and
WAITFORCALLBACKS for more information.
Warning: Class
‘graphics.datacursormanager’
in use at MCR termination.
If your application has terminated unexpectedly, please note that
applications generated by the MATLAB Compiler terminate when there are no
visible figure windows. See the documentation for WaitForFiguresToDie and
WAITFORCALLBACKS for more information.
Warning: Objects of uitools.uibuttongroup class exist - not clearing this class
or any of its super-classes
Warning: Objects of uitools.uimodemanager class exist - not clearing this class
or any of its super-classes
Warning: Objects of uitools.uimode class exist - not clearing this class
or any of its super-classes
Warning: Objects of graphics.datacursormanager class exist - not clearing this
class
or any of its super-classes
MATLAB:imread:fileOpen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I’d like to add something to my comment. I’ve noticed that doubleclicking on the .exe file doesn’t extract the ctf file as you show in your video. Is something wrong with what I’m doing? Maybe an option was left behind where I should’ve clicked.
where USERPROFILE is your Windows user profile directory.
I would suggest creating a regular Standalone Application (not Windows Standalone). Then open up a DOS prompt, and run the executable from there. You should see any error messages that may pop up in the process.
Thank you very much. I debugged using the technique you told me. I found out that my png pictures weren’t found by the program because I didn’t include them in the “other files” section in deploytool (since I followed Doug’s video, but he didn’t use any images).
So, I think this will help Mukund, if you ever have files other than .m or .fig, include them in the Other Files section or the program will not work.
I have another question though. If there’s a new release of MCR (for instance, in MATLAB 2009a), will my program in 2008a (compiled exe file) work in the new MCR? Or should I save a copy of the old MCR.
I just want to mention one thing. If the images that you are loading with your program are something that you always need together with your program, then yes you need to add it as “other files”. This is true for any other files that your application needs to “load”. But if your application is meant for loading an arbitrary image that the user specifies, then you shouldn’t have to include them in the application. In this case, one of the common mistakes is that people use just the file name, instead of the complete path of the file. For example, instead of
filename = uigetfile('*.png');
im = imread(filename);
you should use
[filename, pathname] = uigetfile('*.png');
im = imread(fullfile(pathname, filename));
This will ensure that your function will work regardless of where the image file is on your computer.
Regarding your question about MCR, your application will only run with the same version of MCR used to deploy. So your application compiled in R2008a will not run on R2007b or R2008b MCR. But, multiple versions of MCR can co-exist on a computer, and your application will automatically choose the appropriate MCR. That means that when you create other applications in future releases, those applications can run with the new MCR, while your old application can also run on the same computer using the older MCR.
Thank you very much Jiro. Your comment completely helped me and also gave me a new perspective on user specifying a specific file. My images were my University’s logo and a flow chart in png, so those weren’t to choose. About the MCR, do you recommend to package the MCR on every deployment? or instead of that to have copies of every MCR Installer that is released?
I think it really depends on your situation. If you are deploying to only a few computers, it might make sense to install the MCR each new release that you get. If you are distributing to a large number of end users, it might be better to package together the MCR with your deployment. Or you may only want to provide the MCR for the first few applications.
Hi Doug. I’m using MatLab 2008a and trying to compile a GUI with an uitable component. The GUI is running great on MatLab but it doen’t work in the standalone application. Do you know what is happening and how to fix it?
i have the application which will take the commands from the GUI and read the data available from files. The m file then process the data. So overall i have the application with m files, fig files, text or excel file, and logos stored at different directories.
i want to bulid the .exe. i am giving initial script as the main file and all other files(logos, m and fig files) under other files. it is creating the .exe but after running it, the GUI is quitting (irrespective of waitfor command while calling the fig).
i hv the set of script and function m files. is it due to this. or is thr any other reason for the same.
could u please guide me for the problem..
dear doug,
your video was very excellent and helpful for me. That was perfect answer for my questions. But a problem remains for me. When i run my program a DOS window is opend that is not my favor. Is a way to resolve this problem.
Doug,
Bringing back a previous discussion topic - compiling a GUI which contains table objects. Unfortunately, I switched to R2008a to be able to use the new uitable, which is exactly what fails to compile properly…
Indeed, including arrayviewfunc.m and workspacefunc.m in the compilation helped in eliminating the errors. However, the issue of a non-numeric table showing blank cells remains unsolved. Is there any news with regards to that?
Is there a reasonable workaround that I can use in the meantime? (switching the object’s parent after each call to ‘drawnow’ works, but since I continuously update a plot in that figure - it causes the table to flicker).
I am not able to run the ‘deploytool’ on my Matlab 2007a. ??? Undefined function or variable ‘deploytool’ is the error message received. Pls let me know how I can run this tool.
As Doug mentioned back in comment 14, DEPLOYTOOL is part of MATLAB Compiler. You can check if you have MATLAB Compiler installed by calling the VER function and checking for it in the list of products.
You can go to http://www.mathworks.com -> Support. Login then choose ‘Bug Reports’. The bug report ID is 449936 - ‘Unable to deploy applications that contain uitables’. Downloading the patch file and following workaround instructions… Good luck!
Hi Joanna,
Thanks for the reply. However, this takes care only of the compilation errors (equivalent to including arrayviewfunc.m and workspacefunc.m in the compilation) and does not solve the problem of non-numeric tables showing blank cells.
Looks like bug report # 456568 ‘Compiled GUIDE GUIs that contain UITables do not show table data at run time’ refers to the problem I’m encountering. No workaround provided yet.
Hello Doug,
Great article.
I have matlab r14 sp3.
I noticed one thing when I was making a standalone application of my GUI. My GUI had uigetfile and errdlg functions. When I do
mcc -m mygui.m
it makes a mygui.exe (and .ctf) file which works fine with all the uigetfile and errdlg functionality, but, the command window in the background freezes and cannot be moved or minimized.
This is only true when the gui code in the background uses the uigetfile or errdlg functions. While using other functions/commands, the background command window doesn’t freeze and can be minimized.
Any thoughts?
Vivek
Hi Doug,
I have MATLAB 2007b..
I built a Sample GUI Application like you have told in the video using Deploytool.. using WINDOWS STANDALONE APPLICATION..
But still the DOS Box appears in the background.. !!!
Any thoughts on this…
I am using R2008a and am using the deploytool to create a standalone GUI application. The exe generation part works fine. Where I am having trouble is figuring out a way to get the path of the standalone executable that the user double-clicked. The ctfroot command points to a place in Local Settings\Application Data\…\myApplication which apparently gets generated on the fly when I first run the executable and it recreates all o fthe .m files in that location. This is not the directory I want. The directory I want is the directory in which the user double-clicked the original standalone .exe file. This is because I have a subdirectory in that directory where the user can place files for my program to load. So I need to know where the original .exe file is so I can locate the subdirectory. pwd and matlabroot do not work either. Any ideas?
It turns out I was able to solve my problem by disabling my startup.m script using the isdeployed flag with an if statement around the entire code block.
I normally use the startup.m file to automatically switch matlab to my current project folder of interest. I didn’t realize that when you deploy a standalone application, the startup.m file gets sucked into the mix, even though it is not in the list of m-files in the deploytool project! Perhaps there is a setting I haven’t found that can disable this “feature”.
So when I ran the standalone executable, it was actually running a copy of my startup.m file before launching! This was changing my default pwd path. Once I set the startup.m to run like
if ~isdeployed
…startup code…
end
then pwd pointed to the correct path where the standalone executable lives.
I am trying to create an .exe file for my project that I have developed in Matlab, having several GUIs and .m files. However I cannot create an executable file for my main GUI that calls the other GUIs. (I can create executable file for every single GUI).
Can you please help me?
PS.I have read in a webpage that functions that use variable argument lists (varargin), cannot become executable and my main GUI uses varargin. Is it because of that?
Hi Doug,
I am creating a graphical interface in Matlab 7.0.1. My interface as images and when I use the mcc compiler it does not compiles the images, I mean it creates the .exe file but when I try to use it it requests the .jpg files to be in the same folder taht the .exe created. Is there an option in this version of the Matlab compiler (as it does not have the deploytool) that allows me to create a stand alone application that does not need to have the images together with it to run?
I am trying to create an .exe file for my project that I have developed in Matlab, having several GUIs and .m files. However I cannot create an executable file for my main GUI that calls the other GUIs. (I can create executable file for every single GUI).
Can you please help me?
PS.I have read in a webpage that functions that use variable argument lists (varargin), cannot become executable and my main GUI uses varargin. Is it because of that?
I’m building a GUI and I like to know how to get a subscript, or some other mathematical expression for example in a static text. I’d then like to write
set(handles.static_text,’String’,'\sum_{n=0}^{k}\frac{x^{n}’)
to display but this doesn’t work.
Any help would be highly appreciated!
Thanks.
Henry
Apologies for banging the ‘uitable compile-error’ drum once again (see 32, 36 etc above), but does anyone know whether a satisfactory workaround or fix has been produced to overcome the problem of values/text disappearing from a GUI table in its ‘compiled’ form?
I’ve discovered that, although info disappears once the user has clicked onto another table cell of the compiled GUI, the data entered is still comitted to memory for use in subsequent calculations - it just isn’t visible in the table cells. Most frustrating! We too upgraded to R2008 for this purpose - so any help would be gratefully received.
I built a GUI and write a help for it in “chm” (compiled HTML file) format, and I can’t find a comment in matlab for openig this file. Is here a comment to opning this
file(s)?
Hello,
I have compiled standalone application with deploytool. It would work fine, but the error is in c:\user\Administrator\AppData\Local\MathWorks\mcr_cache_v78\myprog_…..\toolbox\images\icons\point.png
This icon is missed and everytime the program try to call it, it crashes. Wenn I copy this icon manually to this folder - it works!
My question is how to compile my program together with this necessary icon? I think it must be compiled automatically. Wich previos version of matlab compiler I had no problems.
Thanks very much for help.
Leo
Hi Chris,
I tried everything I could think of, and have sent several observations about this bug to support, but eventually lost all hope that this bug will be fixed in the immediate future (it has been already 2.5 months since I encountered it).
The examples that Yair supplies make it very easy to learn how to use it, even for someone with no previous experience with Java (like me…). Furthermore, this works great (and compiles) on previous versions of Matlab, so no need to upgrade to R2008x, and you can enjoy the much smaller MCR file size (150MB in 2007a vs. 240MB in 2008a).
I’ve got a problem when compiling a GUI that no-one else has mentioned here. I’m using mac OS 10.5 and I’ve got around all the problems with specifying the library path so I can run non-GUI *.m code. However, a compiled GUI won’t let me change the values in the EditText boxes. The cursor is blinking in the EditText box, but when I type a number it just appears in the Terminal. I’ve tried making the figure modal, but that didn’t help. Is there something obvious that I’m doing wrong?
Hi! Thanks for a great tutorial! Unfortunately I ran into some problems when I followed your tutorial, the DOS-box still appears although I chose Windows stand-alone application. I saw you mentioned the -e flag in an earlier post, but how do I do that? According to the matlab help -F (for projects) cannot be used with any other flag. How come I need to specify this when all other tutorials do not mention this? Thanks again!
I’m trying to compile using DEPLOYTOOL in 2007a (I *do* have access to more recent versions of Matlab, but not immediately at hand) a more substantial GUI with menus that invoke Callback functions. Unfortunately, the variables being passed into these functions no longer exist when the Callbacks are invoked.. I get errors indicating that the variable is not found. Are there any resources you can point me towards to help me make this work?
Use the compiler options file, it is found at the bottom of the dialog that you get when clicking on the “Open project settings window” button on the Deploy Tool.
and it works perfectly in Matlab. However after compiling the gui to a executable, I do get the the question dialog but clicking ‘Yes’ doesn’t close the exe.
Hi Doug,
***********************
Doug replied on June 25th, 2009 at 14:27 UTC :
Richard,
Use the compiler options file, it is found at the bottom of the dialog that you get when clicking on the “Open project settings window” button on the Deploy Tool.
***********************
I follow this exactly but it does not work. The DOS window still appears. Please advise. Thanks.
Leave a Reply
About
Bob, Brett & Jiro share their favorite user-contributed submissions from the File Exchange.
Very useful guide. But when I went to the deployment tool, “windows Standalone application” was not one of the options. Also, when I tried to run the deployment tool on a GUI i created, it asked which compiler I wanted to use. Is there a specific one that needs to be used? Also, how do you generate and send out the MCR file that you discussed? Thanks!
The MATLAB Compiler deployment target “Windows Standalone Application” was new with MATLAB R2007b. Older versions only had the “Standalone Application” option - the difference being the new Windows Standalone Application does not start a command console (dos box).
The first time you use MATLAB Compiler, it needs to be configured to use a compiler. There is a list of supported compilers on The MathWorks website (TechNote 1601):
http://www.mathworks.com/support/tech-notes/1600/1601.html
You can include the MATLAB Component Runtime (MCR) with your MATLAB Compiler generated executable by using the packaging feature of deploytool. By default the MCR is not included with the executable because of its size. However, if you go into the deploytool settings, under packaging, you can optionally choose to include it. This tab will also show you where the MCR is located on your file system if you want to distribute it separately.
Good luck!
Thanks very much for this tutorial. I have R2006a - could you show how I can compile a GUI using this version?
Jim,
R2006a did not have the deploytool. If you contact support
http://www.mathworks.com/support
they can give you details on how to do this. You might even be able to upgrade to the newest version of MATLAB, depending on what you company has purchased.
Doug
I have R2007a ,and I want make some wavelet function to COM,and use the COM in Visual Basic,but I have tried many times,all lost.Could you give me some suggestion?Thanks.
Lian,
I would need more details to help. I think you are better off going to support directly:
http://www.mathworks.com/support
Cheers,
Doug
function xiaobo
n=[1:50];
x=sin(pi/10*n+pi/3)+2*cos(pi/7*n);
w=randn(1,length(n));
y=x+w;
subplot(3,1,1);
plot(x);
subplot(3,1,2);
plot(y);
xd=wden(y,’minimaxi’,’s’,'one’,5,’db3′);
subplot(3,1,3);
plot(xd);
title(’ok’);
grid;
This function work well in matlab.
I try to use mcc -vm xiaobo.m to gain a application, but throw
following errors
size of your application. Please wait…
…CTF archive extraction complete.
??? Index exceeds matrix dimensions.
Error in ==> wtbxmngr at 75
Error in ==> dwtmode at 158
Error in ==> dwt at 54
Error in ==> wavedec at 43
Error in ==> wden at 62
Error in ==> xiaobo at 10
MATLAB:badsubscript
Warning: 1 visible figure(s) exist at MCR termination.
did the mcc compiler support wavelet function well?
did the matlab builder for .net support wavelet function well?
please help me? thanks
Got exactly the same problem!
I cannot really figure out what is that about…
Any help would be highly appreciated!
Thanks
Marco
liantaodu and Marco Trincavelli,
I was unable to reproduce this error in MATLAB R2007b on windows.
I copied your code exactly from above, and used the same compiler command. The resulting application behaved the same as the MATLAB function.
Perhaps this was an issue that already been addressed by the developers?
Dave
I am trying to just run the magicsquare.m file to creat stand alone execytable. But when I try to run the exe file it says ” This application has failed to start because mclmcrrt77.dll was not found. Re-installing the application may fix this problem”.
Can you please suggest the possible reason. I am remotely using the matlab from a server.
Thanks.
Omar
Omar,
Please contact support:
http://www.mathworks.com/support
Doug
very nice show!
But i am not being able to access the deployment tool.
I’ve written deploytool and pressed enter. But it replays me undefined function…
So, what to do… i must be greatful to you…
I have seen this video more than 20 times but not getting the answer how to access the deploytool?
Please help me!
My Matlab version is 7.1
Is it a problem for not finding Deploument Tool?
please answer me as soon as possible… i am in a big trouble!
Tapon,
This is an additional product:
http://www.mathworks.com/products/compiler/
You need to purchase the MATLAB Compiler for this function.
Doug
Tapon,
Also, if you do have MATLAB Compiler, “deploytool” was added to the product in R2006b. If you have an older version of the MATLAB Compiler, you need to use the command line functionality (mcc).
jiro
Thanks! for reply…
It will be my pleasure if you give me the answer of following…
I made a GUI and saved the m.file in the work directory. thus wrote the command [mcc -mv filename.m] in the command window.
It generates a filename.exe file. this file is executabe.
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?
Tapon,
Which version of MATLAB are you using? Does the .exe file run successfully on the same computer?
You have to install the MCR on machines that do not have MATLAB. Take a look at the documentation for MATLAB Compiler (there might be a section called “Deployment Process”)
If you are having more problems, I suggest you contact support:
http://www.mathworks.com/support
jiro
Thanks a lot…
I have solved my problem by the significant help of all of you
Dear Doug,
Your video is excellent. I’m using Matlab R2008a and have a problem. I used the deploytool and compiled a program I’m coding for Line Codes. It uses 2 .fig GUIs and 4 .m files (2 for figures and 2 as support for the figures). The 2 GUIs are the splash screen (with my name on it) and the main screen. So on the deploytool I put, as main function, the splash.m file. Then I compiled.
The program runs great in MATLAB, but the exe file seems to open and close really fast (not showing anything). If I compile using mcc -e, the program works but I cannot run it in other non MATLAB computers. I also saw that MCR Installer is at “C:\MATLAB\toolbox\compiler\deploy\win32\” Can I take that installer to other computers, run it and then run my program compiled using mcc -e? Or do I need to package it using deploytool? Why is my program not working with deploytool?
Thanks a lot! Keep up the great work!
I have got exactly the same issue as Julio. Please help!
I even tried waitforcallbacks(true) in the GUIopening function but still
Can you please tell which compiler you use?
Thanks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
If your application has terminated unexpectedly, please note that
applications generated by the MATLAB Compiler terminate when there are no
visible figure windows. See the documentation for WaitForFiguresToDie and
WAITFORCALLBACKS for more information.
Warning: Class
‘uitools.uimodemanager’
in use at MCR termination.
If your application has terminated unexpectedly, please note that
applications generated by the MATLAB Compiler terminate when there are no
visible figure windows. See the documentation for WaitForFiguresToDie and
WAITFORCALLBACKS for more information.
Warning: Class
‘uitools.uimode’
in use at MCR termination.
If your application has terminated unexpectedly, please note that
applications generated by the MATLAB Compiler terminate when there are no
visible figure windows. See the documentation for WaitForFiguresToDie and
WAITFORCALLBACKS for more information.
Warning: Class
‘graphics.datacursormanager’
in use at MCR termination.
If your application has terminated unexpectedly, please note that
applications generated by the MATLAB Compiler terminate when there are no
visible figure windows. See the documentation for WaitForFiguresToDie and
WAITFORCALLBACKS for more information.
Warning: Objects of uitools.uibuttongroup class exist - not clearing this class
or any of its super-classes
Warning: Objects of uitools.uimodemanager class exist - not clearing this class
or any of its super-classes
Warning: Objects of uitools.uimode class exist - not clearing this class
or any of its super-classes
Warning: Objects of graphics.datacursormanager class exist - not clearing this
class
or any of its super-classes
MATLAB:imread:fileOpen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I’d like to add something to my comment. I’ve noticed that doubleclicking on the .exe file doesn’t extract the ctf file as you show in your video. Is something wrong with what I’m doing? Maybe an option was left behind where I should’ve clicked.
Thanks!
Julio,
In R2008a, the extracted CTF files can be found at
where USERPROFILE is your Windows user profile directory.
I would suggest creating a regular Standalone Application (not Windows Standalone). Then open up a DOS prompt, and run the executable from there. You should see any error messages that may pop up in the process.
Jiro,
Thank you very much. I debugged using the technique you told me. I found out that my png pictures weren’t found by the program because I didn’t include them in the “other files” section in deploytool (since I followed Doug’s video, but he didn’t use any images).
So, I think this will help Mukund, if you ever have files other than .m or .fig, include them in the Other Files section or the program will not work.
I have another question though. If there’s a new release of MCR (for instance, in MATLAB 2009a), will my program in 2008a (compiled exe file) work in the new MCR? Or should I save a copy of the old MCR.
Thanks again guys, keep up the great work!
Julio,
I just want to mention one thing. If the images that you are loading with your program are something that you always need together with your program, then yes you need to add it as “other files”. This is true for any other files that your application needs to “load”. But if your application is meant for loading an arbitrary image that the user specifies, then you shouldn’t have to include them in the application. In this case, one of the common mistakes is that people use just the file name, instead of the complete path of the file. For example, instead of
filename = uigetfile('*.png');im = imread(filename);
you should use
[filename, pathname] = uigetfile('*.png');im = imread(fullfile(pathname, filename));
This will ensure that your function will work regardless of where the image file is on your computer.
Regarding your question about MCR, your application will only run with the same version of MCR used to deploy. So your application compiled in R2008a will not run on R2007b or R2008b MCR. But, multiple versions of MCR can co-exist on a computer, and your application will automatically choose the appropriate MCR. That means that when you create other applications in future releases, those applications can run with the new MCR, while your old application can also run on the same computer using the older MCR.
Hope this helps.
Thank you very much Jiro. Your comment completely helped me and also gave me a new perspective on user specifying a specific file. My images were my University’s logo and a flow chart in png, so those weren’t to choose. About the MCR, do you recommend to package the MCR on every deployment? or instead of that to have copies of every MCR Installer that is released?
Thanks again!
Julio,
I think it really depends on your situation. If you are deploying to only a few computers, it might make sense to install the MCR each new release that you get. If you are distributing to a large number of end users, it might be better to package together the MCR with your deployment. Or you may only want to provide the MCR for the first few applications.
Hi Doug. I’m using MatLab 2008a and trying to compile a GUI with an uitable component. The GUI is running great on MatLab but it doen’t work in the standalone application. Do you know what is happening and how to fix it?
Thanks in advance.
This is a known limitation. See the discussion here, with a workaround suggested by one user:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/166196#431145
We hope to have this fixed in R2008B.
hi all,
i have the application which will take the commands from the GUI and read the data available from files. The m file then process the data. So overall i have the application with m files, fig files, text or excel file, and logos stored at different directories.
i want to bulid the .exe. i am giving initial script as the main file and all other files(logos, m and fig files) under other files. it is creating the .exe but after running it, the GUI is quitting (irrespective of waitfor command while calling the fig).
i hv the set of script and function m files. is it due to this. or is thr any other reason for the same.
could u please guide me for the problem..
Thanks…
dear doug,
your video was very excellent and helpful for me. That was perfect answer for my questions. But a problem remains for me. When i run my program a DOS window is opend that is not my favor. Is a way to resolve this problem.
Thank you beforehand,
Hashem Shahsavany,
Hashem,
Take a look at this documentation:
http://www.mathworks.com/access/helpdesk/help/toolbox/compiler/mcc.html
It talks about the ‘-e’ option to suppress the command window. Give it a try.
Doug
Doug,
Bringing back a previous discussion topic - compiling a GUI which contains table objects. Unfortunately, I switched to R2008a to be able to use the new uitable, which is exactly what fails to compile properly…
I’m aware of the discussion here: http://www.mathworks.com/matlabcentral/newsreader/view_thread/166196#431145
Indeed, including arrayviewfunc.m and workspacefunc.m in the compilation helped in eliminating the errors. However, the issue of a non-numeric table showing blank cells remains unsolved. Is there any news with regards to that?
Is there a reasonable workaround that I can use in the meantime? (switching the object’s parent after each call to ‘drawnow’ works, but since I continuously update a plot in that figure - it causes the table to flicker).
Thanks!
Moran
Hi,
I am not able to run the ‘deploytool’ on my Matlab 2007a. ??? Undefined function or variable ‘deploytool’ is the error message received. Pls let me know how I can run this tool.
Thanks.
David,
As Doug mentioned back in comment 14, DEPLOYTOOL is part of MATLAB Compiler. You can check if you have MATLAB Compiler installed by calling the VER function and checking for it in the list of products.
Hi Moran,
You can go to http://www.mathworks.com -> Support. Login then choose ‘Bug Reports’. The bug report ID is 449936 - ‘Unable to deploy applications that contain uitables’. Downloading the patch file and following workaround instructions… Good luck!
Hi Joanna,
Thanks for the reply. However, this takes care only of the compilation errors (equivalent to including arrayviewfunc.m and workspacefunc.m in the compilation) and does not solve the problem of non-numeric tables showing blank cells.
Looks like bug report # 456568 ‘Compiled GUIDE GUIs that contain UITables do not show table data at run time’ refers to the problem I’m encountering. No workaround provided yet.
Cheers,
Moran
Hello Doug,
Great article.
I have matlab r14 sp3.
I noticed one thing when I was making a standalone application of my GUI. My GUI had uigetfile and errdlg functions. When I do
mcc -m mygui.m
it makes a mygui.exe (and .ctf) file which works fine with all the uigetfile and errdlg functionality, but, the command window in the background freezes and cannot be moved or minimized.
This is only true when the gui code in the background uses the uigetfile or errdlg functions. While using other functions/commands, the background command window doesn’t freeze and can be minimized.
Any thoughts?
Vivek
Hi Doug,
I have MATLAB 2007b..
I built a Sample GUI Application like you have told in the video using Deploytool.. using WINDOWS STANDALONE APPLICATION..
But still the DOS Box appears in the background.. !!!
Any thoughts on this…
Lokesh,
http://www.mathworks.com/access/helpdesk/help/toolbox/compiler/mcc.html
You want switch ‘-e’ to suppress command window.
Enjoy
I am using R2008a and am using the deploytool to create a standalone GUI application. The exe generation part works fine. Where I am having trouble is figuring out a way to get the path of the standalone executable that the user double-clicked. The ctfroot command points to a place in Local Settings\Application Data\…\myApplication which apparently gets generated on the fly when I first run the executable and it recreates all o fthe .m files in that location. This is not the directory I want. The directory I want is the directory in which the user double-clicked the original standalone .exe file. This is because I have a subdirectory in that directory where the user can place files for my program to load. So I need to know where the original .exe file is so I can locate the subdirectory. pwd and matlabroot do not work either. Any ideas?
Hi Scott,
Drop me a note at Todd(dot)Flanagan(at)mathworks(dot)com. I have a mex file that solves this problem.
Todd
It turns out I was able to solve my problem by disabling my startup.m script using the isdeployed flag with an if statement around the entire code block.
I normally use the startup.m file to automatically switch matlab to my current project folder of interest. I didn’t realize that when you deploy a standalone application, the startup.m file gets sucked into the mix, even though it is not in the list of m-files in the deploytool project! Perhaps there is a setting I haven’t found that can disable this “feature”.
So when I ran the standalone executable, it was actually running a copy of my startup.m file before launching! This was changing my default pwd path. Once I set the startup.m to run like
if ~isdeployed
…startup code…
end
then pwd pointed to the correct path where the standalone executable lives.
Hey Scott,
I am trying to create an .exe file for my project that I have developed in Matlab, having several GUIs and .m files. However I cannot create an executable file for my main GUI that calls the other GUIs. (I can create executable file for every single GUI).
Can you please help me?
PS.I have read in a webpage that functions that use variable argument lists (varargin), cannot become executable and my main GUI uses varargin. Is it because of that?
Thank you in advance
Hi Doug,
I am creating a graphical interface in Matlab 7.0.1. My interface as images and when I use the mcc compiler it does not compiles the images, I mean it creates the .exe file but when I try to use it it requests the .jpg files to be in the same folder taht the .exe created. Is there an option in this version of the Matlab compiler (as it does not have the deploytool) that allows me to create a stand alone application that does not need to have the images together with it to run?
Thanks in advance,
Carol
Carol,
If your program reads in the files, you will need to include them since the compiled version will work the same as the MATLAB one.
Doug
Hey Doug,
I am trying to create an .exe file for my project that I have developed in Matlab, having several GUIs and .m files. However I cannot create an executable file for my main GUI that calls the other GUIs. (I can create executable file for every single GUI).
Can you please help me?
PS.I have read in a webpage that functions that use variable argument lists (varargin), cannot become executable and my main GUI uses varargin. Is it because of that?
Thank you in advance
Hi Doug,
I’m building a GUI and I like to know how to get a subscript, or some other mathematical expression for example in a static text. I’d then like to write
set(handles.static_text,’String’,'\sum_{n=0}^{k}\frac{x^{n}’)
to display but this doesn’t work.
Any help would be highly appreciated!
Thanks.
Henry
Henry,
I think you might like the TEXT function
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/text.html
The first example shows how that is done.
Doug
Hi!
Apologies for banging the ‘uitable compile-error’ drum once again (see 32, 36 etc above), but does anyone know whether a satisfactory workaround or fix has been produced to overcome the problem of values/text disappearing from a GUI table in its ‘compiled’ form?
I’ve discovered that, although info disappears once the user has clicked onto another table cell of the compiled GUI, the data entered is still comitted to memory for use in subsequent calculations - it just isn’t visible in the table cells. Most frustrating! We too upgraded to R2008 for this purpose - so any help would be gratefully received.
Thanks!
Chris
Hi Doug,
I built a GUI and write a help for it in “chm” (compiled HTML file) format, and I can’t find a comment in matlab for openig this file. Is here a comment to opning this
file(s)?
Best regard,
Hashem,
Hello,
I have compiled standalone application with deploytool. It would work fine, but the error is in c:\user\Administrator\AppData\Local\MathWorks\mcr_cache_v78\myprog_…..\toolbox\images\icons\point.png
This icon is missed and everytime the program try to call it, it crashes. Wenn I copy this icon manually to this folder - it works!
My question is how to compile my program together with this necessary icon? I think it must be compiled automatically. Wich previos version of matlab compiler I had no problems.
Thanks very much for help.
Leo
Hi Chris,
I tried everything I could think of, and have sent several observations about this bug to support, but eventually lost all hope that this bug will be fixed in the immediate future (it has been already 2.5 months since I encountered it).
Fortunately, a great alternative exists! Check out Yair Altman’s “CreateTable.m” code:
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=14225&objectType=file
The examples that Yair supplies make it very easy to learn how to use it, even for someone with no previous experience with Java (like me…). Furthermore, this works great (and compiles) on previous versions of Matlab, so no need to upgrade to R2008x, and you can enjoy the much smaller MCR file size (150MB in 2007a vs. 240MB in 2008a).
Hope this helps,
Moran
Hi,
I’ve got a problem when compiling a GUI that no-one else has mentioned here. I’m using mac OS 10.5 and I’ve got around all the problems with specifying the library path so I can run non-GUI *.m code. However, a compiled GUI won’t let me change the values in the EditText boxes. The cursor is blinking in the EditText box, but when I type a number it just appears in the Terminal. I’ve tried making the figure modal, but that didn’t help. Is there something obvious that I’m doing wrong?
Helen,
That question is best asked of tech support. support@mathworks.com
-Doug
Hi! Thanks for a great tutorial! Unfortunately I ran into some problems when I followed your tutorial, the DOS-box still appears although I chose Windows stand-alone application. I saw you mentioned the -e flag in an earlier post, but how do I do that? According to the matlab help -F (for projects) cannot be used with any other flag. How come I need to specify this when all other tutorials do not mention this? Thanks again!
//Patrik
Patrik,
When you generate the .prj file, you can specify the compiler directives, including the -e flag. Once you do that, they will be included in the .prj.
-Doug
plz give me a solution for my problem
my problem is
i want to change the icon of the matlab standalone excecutable file.
Lindo,
Sorry, this is not supported.
Doug
I’m trying to compile using DEPLOYTOOL in 2007a (I *do* have access to more recent versions of Matlab, but not immediately at hand) a more substantial GUI with menus that invoke Callback functions. Unfortunately, the variables being passed into these functions no longer exist when the Callbacks are invoked.. I get errors indicating that the variable is not found. Are there any resources you can point me towards to help me make this work?
Thanks!
Hello Doug,
Can you explain point 56. (about the -e flag) because I can’t seem to find it.
Regards, Richard
Richard:
Find it here:
http://www.mathworks.com/access/helpdesk/help/toolbox/compiler/mcc.html
Doug
Thank you for your reply. I understand that I can specify flags using the mcc command, but is this also possible through the deploytool?
Richard
To whom it may concern, a solution to the dos screen annoyance is found by user ‘vihang’ in this discussion:
http://groups.google.com/group/comp.soft-sys.matlab/browse_thread/thread/0527d566c3b72873
In my case, simply adding “set LINKFLAGS=%LINKFLAGS% -subsystem windows” to compopts.bat does the trick!
Richard
Richard,
Use the compiler options file, it is found at the bottom of the dialog that you get when clicking on the “Open project settings window” button on the Deploy Tool.
Doug
Hello Doug, yet another question. I followed this tutorial:
http://blinkdagger.com/matlab/matlab-gui-tutorial-close-gui-confirmation
and it works perfectly in Matlab. However after compiling the gui to a executable, I do get the the question dialog but clicking ‘Yes’ doesn’t close the exe.
Any help is appreciated. Regards, Richard
I try to compile this code:
With the waveletanalysis_dan1.m is:
function waveletanalysis_dan1(signal,lev,nbcol,topa,colorn,wname,Tsample,Nfig,signalname) %Perform the discrete wavelet transform (DWT) at level 5 using db1. [c,l] = wavedec(signal,lev,wname); %Expand discrete wavelet coefficients for plot. len = length(signal); cfd = zeros(lev,len); for k = 1:lev d = detcoef(c,l,k); d = d(:)'; d = d(ones(1,2^k),:); cfd(k,:) = wkeep1(d(:)',len); end cfd = cfd(:); I = find(abs(cfd)<sqrt(eps)); cfd(I) = zeros(size(I)); cfd = reshape(cfd,lev,len); cfd = wcodemat(cfd,nbcol,'row'); figure(Nfig) %Perform the continuous wavelet transform (CWT) and visualize results set(subplot(3,1,1),'Xtick',[]); plot(signal,'r'); title(strcat('{\bf',signalname,'}')); set(gca,'Xlim',[1 length(signal)]); subplot(3,1,2); colormap(cool(colorn)); image(cfd); tics = 1:lev; labs = int2str(tics'); set(gca,... 'YTicklabelMode','manual','Ydir','normal', ... 'Box','On','Ytick',tics,'YTickLabel',labs ... ); title('Discrete Transform, absolute coefficients.'); ylabel('Level'); set(subplot(3,1,2),'Xtick',[]); subplot(3,1,3); scales = (1:topa); cwt(signal,scales,wname,'plot'); colormap(cool(colorn)); tt = get(gca,'Yticklabel'); [r,c] = size(tt); yl = char(topa*ones(r,c)); for k = 1:1:r , yl(k,:) = tt(k,:); end set(gca,'Yticklabel',yl);The problem is in wavelet analysis. Thanks
Hi Doug,
***********************
Doug replied on June 25th, 2009 at 14:27 UTC :
Richard,
Use the compiler options file, it is found at the bottom of the dialog that you get when clicking on the “Open project settings window” button on the Deploy Tool.
***********************
I follow this exactly but it does not work. The DOS window still appears. Please advise. Thanks.