help-octave
[Top][All Lists]
Advanced

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

Re: How to suppress unneeded output while using "save"


From: Bill Denney
Subject: Re: How to suppress unneeded output while using "save"
Date: Tue, 6 Dec 2005 09:43:11 -0500 (EST)

On Tue, 6 Dec 2005, Steve C. Thompson wrote:
Or `fprintf':

 fid = fopen (filename, 'w');
 for i = 1 : n
   fprintf (fid, '%f %f %f \n', a(1), a(2), a(3));
 end
 fclose (fid);

Or there abouts.

I think that fprintf is more vectorized, so a more general version (not requiring only 3 data points per row in a) would be

fid = fopen (filename, 'w');
for i = 1:size(a,1)
  fprintf(fid, "%d ", a(i,:));
  fprintf(fid, "\n");
endfor
fclose(fid);

Test that out, but it should be close.

Bill

--
"SF author Larry Niven proposed a beer mug that [...] automatically,
silently refilled itself from the keg."
"Hmm, in that case, the obvious course of action is to eat the mug."
  -- DeadVulcan on slashdot



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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