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);