Thread Subject: fprintf for standalone executable

Subject: fprintf for standalone executable

From: jon erickson

Date: 18 Mar, 2008 15:25:03

Message: 1 of 1

I am trying to make a standalone executeable that prints
data to a text file.

I am able to compile and run the program just fine, but the
output is not as desired.

The relevant snippet of code in the mfile in the mfile is:

%write the data matrix
for k = 1:np
 fprintf(fid,'%-6.2f\t', data(k,:));
 fprintf(fid, '\n');
end

As an matlab function it functions properly.
Upon compilation with mcc and executing the program I get
a non-sensical output. (Example of 46 x 512 data matrix
output is shown below).

I know the compiler has limitations on the functions that
are properly executed with a standalone executable, for
instance 'input' does not work, nor does 'save' with tabs
and ascii options. Does fprintf also not work? Any ideas
why I am not getting the desired output and how to fix this?

Many thanks.
jon

Example output...should be a 46 columns by 512 lines...and
it is nowhere close.
---------
4.6000000e+001
  0.0000000e+000
  5.4000000e+001 4.8000000e+001
  5.5000000e+001 4.9000000e+001
  4.9000000e+001 5.0000000e+001 4.8000000e+001
  5.0000000e+001 5.1000000e+001 4.9000000e+001


Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
standalone executable jon erickson 18 Mar, 2008 11:30:07
compiler jon erickson 18 Mar, 2008 11:30:07
fprintf jon erickson 18 Mar, 2008 11:30:07
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com