Writing a commented output to file

AlexG1 alxgel at gmail.com
Wed May 6 05:38:04 CDT 2009




John W. Eaton-3 wrote:
> 
> 
> Here's one more way:
> 
>   fid = fopen ('foo.dat', 'w');
>   fprintf (fid, '%% Some comment 1\n%% Some comment 2\n');
>   nc = size (x, 2);
>   fmt = sprintf ('%s\n', repmat ('%f ', [1, nc]));
>   fprintf (fid, fmt, x');
>  
> 
> 

Thanks, works great. 
There's something I didn't understand though - can you please explain why
the transpose on the fprintf() call is needed?
-- 
View this message in context: http://www.nabble.com/Writing-a-commented-output-to-file-tp23385991p23404086.html
Sent from the Octave - General mailing list archive at Nabble.com.



More information about the Help-octave mailing list