MATLAB how to write header in text file

Posted by Jessy on Stack Overflow See other posts from Stack Overflow or by Jessy
Published on 2010-06-16T09:27:44Z Indexed on 2010/06/16 9:32 UTC
Read the original article Hit count: 345

Filed under:
|
|
|

How to write a text header in text file? for example in the example below, how to write the header code salay month just once?

Code Salary Month
12   1000   12
14   1020   11
11   1212   9 


fid = fopen('analysis1.txt','wt');
for i=1:10
   array = []; % empty the array
   ....
   array = [code salary month];
   format short g;
   fprintf(fid,'%g\t %g\t %g\n',array); % write to file
end
fclose(fid);

© Stack Overflow or respective owner

Related posts about file

Related posts about matlab