Prev: How to Identify 3D position of a point from uncalibrated image.
Next: adding elements to a matrix
From: Charles on 11 May 2010 14:05 Hi, I have a matrix that I would like to write to a text file. I need however to add a title and some comentary at the top of the text file before the matrix I have is written. I can't seem to find a method to do this. Any Suggestions? Thanks
From: dpb on 11 May 2010 14:24 Charles wrote: > Hi, > > I have a matrix that I would like to write to a text file. I need > however to add a title and some comentary at the top of the text file > before the matrix I have is written. I can't seem to find a method to do > this. Any Suggestions? doc fprintf % you can write whatever you wish however you wish Isn't a generic textwrite() function similar to textread(), though, so you'll have to "roll your own". --
From: someone on 11 May 2010 14:36 "Charles " <charles.vaughan.ctr(a)schriever.af.mil> wrote in message <hsc692$mrh$1(a)fred.mathworks.com>... > Hi, > > I have a matrix that I would like to write to a text file. I need however to add a title and some comentary at the top of the text file before the matrix I have is written. I can't seem to find a method to do this. Any Suggestions? > > Thanks Piecing together some examples from "doc fprontf", we have: x = 0:.1:1; y = [x; exp(x)]; fid = fopen('exp.txt', 'wt'); fprintf(fid,'It''s Friday.\n'); fprintf(fid, '%6.2f %12.8f\n', y); fclose(fid) type exp.txt It's Friday. 0.00 1.00000000 0.10 1.10517092 0.20 1.22140276 0.30 1.34985881 0.40 1.49182470 0.50 1.64872127 0.60 1.82211880 0.70 2.01375271 0.80 2.22554093 0.90 2.45960311 1.00 2.71828183
|
Pages: 1 Prev: How to Identify 3D position of a point from uncalibrated image. Next: adding elements to a matrix |