Got Questions? Get Answers.
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:
Error Messages of Compiled Programs

Subject: Error Messages of Compiled Programs

From: Geoffrey

Date: 4 Dec, 2008 14:47:02

Message: 1 of 4

I'm currently developing a GUI based software that will in the end be compiled with the MATLAB Compiler. The problem is, I have a lot of information about error messages currently being sent to the command window using fprintf commands. When I finish the final development, I want a user to be able to access whatever normally would have shown up on the command window.

The problem is that certain callbacks call other functions that have been developed - and every function could write to it at a different time. Has someone run into this problem before, or could suggest ideas about how to go about creating a 'log' file for this situation?

Subject: Error Messages of Compiled Programs

From: Steven Lord

Date: 4 Dec, 2008 14:52:51

Message: 2 of 4


"Geoffrey" <geoffrey.bourque@ch.abb.com> wrote in message
news:gh8qh6$jtq$1@fred.mathworks.com...
> I'm currently developing a GUI based software that will in the end be
> compiled with the MATLAB Compiler. The problem is, I have a lot of
> information about error messages currently being sent to the command
> window using fprintf commands. When I finish the final development, I want
> a user to be able to access whatever normally would have shown up on the
> command window.
>
> The problem is that certain callbacks call other functions that have been
> developed - and every function could write to it at a different time. Has
> someone run into this problem before, or could suggest ideas about how to
> go about creating a 'log' file for this situation?

I'd probably create a function, something like logErrorMessage below, and
call that instead of using ERROR directly:


function logErrorMessage(msgid, msgtxt)
if isdeployed
    % Write to the log file -- perhaps store the fid for the log file in a
persistent variable?
else
    % Write the message to the screen -- perhaps by calling ERROR directly
end


You could also create a logWarningMessage as well.

--
Steve Lord
slord@mathworks.com

Subject: Error Messages of Compiled Programs

From: Geoffrey

Date: 5 Dec, 2008 10:26:01

Message: 3 of 4

"Steven Lord" <slord@mathworks.com> wrote in message <gh8qs3$q4n$1@fred.mathworks.com>...
>
>
> I'd probably create a function, something like logErrorMessage below, and
> call that instead of using ERROR directly:
>
>
> function logErrorMessage(msgid, msgtxt)
> if isdeployed
> % Write to the log file -- perhaps store the fid for the log file in a
> persistent variable?
> else
> % Write the message to the screen -- perhaps by calling ERROR directly
> end
>
>
> You could also create a logWarningMessage as well.
>
> --
> Steve Lord
> slord@mathworks.com
>

That sounds fine. But what happens to all the other messages that would've been called with fprintf( or fprintf(2, ? Do they just get turfed or do I need to make sure my files don't actually contain any of them?

Subject: Error Messages of Compiled Programs

From: Ashish Uthama

Date: 8 Dec, 2008 18:04:58

Message: 4 of 4

On Fri, 05 Dec 2008 05:26:01 -0500, Geoffrey <geoffrey.bourque@ch.abb.com>
wrote:

> "Steven Lord" <slord@mathworks.com> wrote in message
> <gh8qs3$q4n$1@fred.mathworks.com>...
>>
>>
>> I'd probably create a function, something like logErrorMessage below,
>> and
>> call that instead of using ERROR directly:
>>
>>
>> function logErrorMessage(msgid, msgtxt)
>> if isdeployed
>> % Write to the log file -- perhaps store the fid for the log file
>> in a
>> persistent variable?
>> else
>> % Write the message to the screen -- perhaps by calling ERROR
>> directly
>> end
>>
>>
>> You could also create a logWarningMessage as well.
>>
>> --
>> Steve Lord
>> slord@mathworks.com
>>
>
> That sounds fine. But what happens to all the other messages that
> would've been called with fprintf( or fprintf(2, ? Do they just get
> turfed or do I need to make sure my files don't actually contain any of
> them?


How about creating your own FPRINTF, if its first in the path it would get
called instead of MATLAB's FPRINTF. You might have to supress a warning
MATLAB issues about naming conflicts.

Tags for 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