help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Writing text to a separate text file during execution


From: Ben Abbott
Subject: Re: Writing text to a separate text file during execution
Date: Wed, 27 Feb 2013 08:48:31 -0500

On Feb 27, 2013, at 8:44 AM, chris.potvin wrote:

> I need to provide feedback from my octave script on the status of variables. 
> Can someone please help me to write to a text file during execution? 
> Ideally, the text file contents would look something like this:
> 
> Variable y = 5
> Variable z = 9
> etc.
> 
> Thanks in advance,
> Chris


Does this work for you?

x = 5;
y = 9;
fid = fopen ("yourfile.txt");
fprintf (fid, "Variable x = %s\n", num2str (x));
fprintf (fid, "Variable y = %s\n", num2str (y));
fclose (fid)

Ben

reply via email to

[Prev in Thread] Current Thread [Next in Thread]