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

Thread Subject:
Trouble Compiling

Subject: Trouble Compiling

From: Andrew Harris

Date: 18 May, 2011 20:53:03

Message: 1 of 8

I've written a relatively simple program using GUIDE. It runs great in MATLAB. I compiled it, and the compiled .exe launches fine, but I start trying to use it, errors occur. How best should I trouble shoot these problems?

Subject: Trouble Compiling

From: wahyoe Unggul

Date: 18 May, 2011 21:08:03

Message: 2 of 8

"Andrew Harris" <andrew.harris.j@gmail.com> wrote in message <ir1bjf$pg1$1@newscl01ah.mathworks.com>...
> I've written a relatively simple program using GUIDE. It runs great in MATLAB. I compiled it, and the compiled .exe launches fine, but I start trying to use it, errors occur. How best should I trouble shoot these problems?

you try to check your script writing

Subject: Trouble Compiling

From: Ben

Date: 18 May, 2011 21:09:03

Message: 3 of 8

"Andrew Harris" <andrew.harris.j@gmail.com> wrote in message <ir1bjf$pg1$1@newscl01ah.mathworks.com>...
> I've written a relatively simple program using GUIDE. It runs great in MATLAB. I compiled it, and the compiled .exe launches fine, but I start trying to use it, errors occur. How best should I trouble shoot these problems?

What sort of errors? Could there be something wrong in the call back routines?

Subject: Trouble Compiling

From: Steven_Lord

Date: 18 May, 2011 21:44:31

Message: 4 of 8



"Andrew Harris" <andrew.harris.j@gmail.com> wrote in message
news:ir1bjf$pg1$1@newscl01ah.mathworks.com...
> I've written a relatively simple program using GUIDE. It runs great in
> MATLAB. I compiled it, and the compiled .exe launches fine, but I start
> trying to use it, errors occur. How best should I trouble shoot these
> problems?

That depends on the specific errors that occur. Read through this section of
the MATLAB Compiler documentation to determine if any of those scenarios
match what you're doing:

http://www.mathworks.com/help/toolbox/compiler/br2cqa0-2.html

Pay particular attention to whether you're using something that is not
allowed to be compiled:

http://www.mathworks.com/products/compiler/compiler_support.html
http://www.mathworks.com/help/toolbox/compiler/br2cqa0-20.html

If this doesn't indicate the cause or causes of the errors, post the full
text of the error messages here and/or send them to Technical Support.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Trouble Compiling

From: Andrew Harris

Date: 19 May, 2011 00:58:03

Message: 5 of 8

"Steven_Lord" <slord@mathworks.com> wrote in message <ir1ek0$484$1@newscl01ah.mathworks.com>...
>
>
> "Andrew Harris" <andrew.harris.j@gmail.com> wrote in message
> news:ir1bjf$pg1$1@newscl01ah.mathworks.com...
> > I've written a relatively simple program using GUIDE. It runs great in
> > MATLAB. I compiled it, and the compiled .exe launches fine, but I start
> > trying to use it, errors occur. How best should I trouble shoot these
> > problems?
>
> That depends on the specific errors that occur. Read through this section of
> the MATLAB Compiler documentation to determine if any of those scenarios
> match what you're doing:
>
> http://www.mathworks.com/help/toolbox/compiler/br2cqa0-2.html
>
> Pay particular attention to whether you're using something that is not
> allowed to be compiled:
>
> http://www.mathworks.com/products/compiler/compiler_support.html
> http://www.mathworks.com/help/toolbox/compiler/br2cqa0-20.html
>
> If this doesn't indicate the cause or causes of the errors, post the full
> text of the error messages here and/or send them to Technical Support.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Sorry if I am a bit of a MATLAB newbie, but how do I even view the error messages? I double click the .exe file, and my GUI launches correctly. However, when I try interacting with the running GUI, I get the "ping" error sound, and the GUI doesn't operate properly.

Subject: Trouble Compiling

From: ImageAnalyst

Date: 19 May, 2011 01:47:46

Message: 6 of 8

On May 18, 8:58 pm, "Andrew Harris" <andrew.harri...@gmail.com> wrote:
> Sorry if I am a bit of a MATLAB newbie, but how do I even view the error messages? I double click the .exe file, and my GUI launches correctly. However, when I try interacting with the running GUI, I get the "ping" error sound, and the GUI doesn't operate properly.
--------------------------------------------------------------------------
First check the FAQ:
http://matlab.wikia.com/wiki/FAQ#My_standalone_executable_won.27t_run_on_the_target_computer._What_can_I_try.3F

You get the ping sound because there is an error. If you didn't
suppress the console window via a compile option, then you should see
the error message in that window. If you got an error and your app
terminated and the console window vanished, then you'll have to either
1) get a window first. In Windows do start/run/cmd. Then change
folder to where you executable lives and run your app. When you app
fails, the error message will still be visible in the console window.
2) run your app from within the MATLAB command window. At the prompt
type an exclamation point followed by your executable name, like !
myapp.exe

With either of those methods, your errors should be visible.

Next, tell us what those errors say. Often, VERY often, it's a
problem of looking for some data files that are not in the current
folder or where they are supposed to be. Pay particular attention to
#7 in the FAQ list. Make sure you make full use of try/catch,
fullfile(), and exist() to avoid any problems. You NEED to do that if
you're going to write robust code. NEVER assume anything will be
where you expect it to be. Always construct full filenames (folder+
base filename) and always check that the file exists - not checking
for this is probably the cause of the vast majority of run time
errors.

Subject: Trouble Compiling

From: Andrew Harris

Date: 21 May, 2011 19:15:20

Message: 7 of 8

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <fc647d5c-be18-4350-bdc8-701d4d80002b@n10g2000yqf.googlegroups.com>...
> On May 18, 8:58 pm, "Andrew Harris" <andrew.harri...@gmail.com> wrote:
> > Sorry if I am a bit of a MATLAB newbie, but how do I even view the error messages? I double click the .exe file, and my GUI launches correctly. However, when I try interacting with the running GUI, I get the "ping" error sound, and the GUI doesn't operate properly.
> --------------------------------------------------------------------------
> First check the FAQ:
> http://matlab.wikia.com/wiki/FAQ#My_standalone_executable_won.27t_run_on_the_target_computer._What_can_I_try.3F
>
> You get the ping sound because there is an error. If you didn't
> suppress the console window via a compile option, then you should see
> the error message in that window. If you got an error and your app
> terminated and the console window vanished, then you'll have to either
> 1) get a window first. In Windows do start/run/cmd. Then change
> folder to where you executable lives and run your app. When you app
> fails, the error message will still be visible in the console window.
> 2) run your app from within the MATLAB command window. At the prompt
> type an exclamation point followed by your executable name, like !
> myapp.exe
>
> With either of those methods, your errors should be visible.
>
> Next, tell us what those errors say. Often, VERY often, it's a
> problem of looking for some data files that are not in the current
> folder or where they are supposed to be. Pay particular attention to
> #7 in the FAQ list. Make sure you make full use of try/catch,
> fullfile(), and exist() to avoid any problems. You NEED to do that if
> you're going to write robust code. NEVER assume anything will be
> where you expect it to be. Always construct full filenames (folder+
> base filename) and always check that the file exists - not checking
> for this is probably the cause of the vast majority of run time
> errors.

Thank you so much for this useful advice; you hit the nail on the head. I'm still not sure how best to overcome the error though.

I've written a GUI program used for designing bridges. When the GUI launches, the first thing the user does is load a set of surveying data. The code looks like this:

% Ask the user to choose their surveying data
fileName = uigetfile('*.xls*');

% Read in surveying data
data = xlsread(fileName);

This was working fine when the script was being run in MATLAB with the user able to choose a .xlsx file anywhere. Now that it's been compiled, however, it only seems to work if the .xlsx file is in the same folder as the .exe. Why this change in uigetfile's functioning?

Again, thanks for your help.

Subject: Trouble Compiling

From: ImageAnalyst

Date: 21 May, 2011 20:55:22

Message: 8 of 8

Yes, of course because filename is only the BASE filename, not the
full file name. You need to accept both output arguments of uigetfile
and combine them with fullfile() to get the full flilename, something
like this

% Ask the user to choose their surveying data
[baseFileName folder] = uigetfile('*.xls*');

% Construct full filename
fullFileName = fullfilw(folder, baseFileName);

% Read in surveying data
data = xlsread(fullFileName );

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us