help-octave
[Top][All Lists]
Advanced

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

Re: Problem with Matlab script


From: Nicholas Jankowski
Subject: Re: Problem with Matlab script
Date: Thu, 24 Mar 2016 13:30:14 -0400

On Thu, Mar 24, 2016 at 11:26 AM, Dmitri A. Sergatskov <address@hidden> wrote:


On Wed, Mar 23, 2016 at 7:30 AM, Nicholas Jankowski <address@hidden> wrote:
On Tue, Mar 22, 2016 at 3:19 PM, Riedel Thomas <address@hidden> wrote:
Hi guys,

i have a problem with a matlab script i like to run in Octave.
The commands below do not result in an output of a text file (Results_formulas.txt).
I suspect that the matlab syntax for "fprintf" does not work here, but i cannot figure out the error.
Many thanks for your help,

Thomas!


output_file = ['Results_formulas.txt'];
data = ""> fid = fopen(output_file,'wt');
fprintf(fid,'%4.5f %4.6f %2.0f %2.0f %2.0f %2.0f %2.0f %1.0f %8.0f %5.0f %3.0f %4.2f %1.5f %2.0f %2.0f %7.0f %1.0f %1.0f %1.0f %1.0f\n', data);

after I substituted actual values for data (I just did data = "" ) I have no problem running the script you provided. I get a text file named Results_formulas.txt, and it has a row of data formatted as you specified. I verified that the results are the same in Matlab. (I'm running Octave 4.0.0 on windows)

maybe you can provide a sample of the actual data giving you problems? and copy paste any error messages exactly as they appear?

Nick J



​I think you may need to fclose(fid). I assume if you close octave it dose it for you, but
otherwise the file may or may not be flashed to disk.​

​Dmitri.

--



Just to confirm, in Octave 4.0.1 on Windows using the steps above the text file is empty until running fclose.  I'm not sure if this is the case in Matlab, or if it's OS dependent.

reply via email to

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