MATLAB Answers

Rushabh Shah

Regarding exe file created from Matlab Compiler.

Asked by Rushabh Shah
on 18 May 2013

I am currently in last semester of B.E. and my project is based on gesture recognition. So I have done blob analysis to identify rgb color tape. So by these three colors I can create different gestures. By every gestures I can do different activities like mouse move, left click, right click, drag and drop and many other things. Now I want to create windows standalone application using Matlab Compliler. I had follow the same procedure. First add main file, install MCR. But still there are several issues. The issues are as below:

  1. After creating .exe file, to run that file it would take lot of time. I don't know why is this so?
  2. This would be major one. Well, in .m file I have used red and blue color to do several actions. I have called java class for that. ".m" file runs completely fine. But the same thing for .exe there is problem. I have run the .exe file.

(Info: To move the mouse I have used single red color and for left and right click I have used red and blue color together.) In .exe file if I take red color in front of webcam to move mouse then it will run. But whenever I take blue color with red color in front of webcam to do right click or left click then .exe file gets terminated. I don't know why my .exe file gets terminated. Please help me with this.


2 Answers

Answer by Walter Roberson
on 18 May 2013
 Accepted answer

Running the .exe file takes a long time because .exe files produced using MATLAB Compiler are more or less just MATLAB sessions without the command prompt or desktop, and so the .exe files take as long to start up as a MATLAB session takes.

We do not know enough about your code to be able to guess why your program crashes when you use blue. Is any error message produced? Have you tried creating a console version and running it within a Windows command shell to see if you can see any messages ? Have you tried outputting status updates as variables portions are executed so that you can isolate which section of the code is failing ?


Ya at last it didn't show anything...When I bring blue color with red color in front of webcam .exe file execution just terminated.Ya I check task manager there was no application running in it.How can I see errors of my .exe file.One thing I want to tell you that I have made .exe file just for color detection purpose no any java class included then it runs completely fine.Two colors can be detected simultaneously.So why would this so?

Ya error message displayed is "Undefined variable InputEvent or Undefined Function InputEvent.Button1_MASK".So what would be the error?I don't know.Does it regarding to Java class?Help me to solve this error.

Thank you Walter Roberson.I finally able to solve my problem and my project runs perfect.Thank you for your help.Thank you to Image Analyst.

Answer by Image Analyst
on 18 May 2013

Regarding crashes, run it in a console window like Walter recommends. Also, make sure your functions have a try/catch so you can see what went wrong.

  % Some code that may produce an error.
catch ME
	errorMessage = sprintf('Error in function blah_blah_blah().\n\nError Message:\n%s', ME.message);
	fprintf(1, '%s\n', errorMessage);


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!