MATLAB: How to print blank rows on top of CSV file

csvfprintf

I am using fprintf to output a matrix to .CSV and I was wondering there is a way to print out the file so that there are 3 blank rows before the data. I tried just printing out '\n' before the data, but there's no sign of it when I open the .CSV file.

Best Answer

Yes. It should give you a blank row. Print a whitespace should also do it.
fid=fopen('test.csv','w+t');
fprintf(fid,'\n');
fprintf(fid,'%s\n','line');
a={' ',' ','text'};
fprintf(fid,'%s\n',a{:});
fclose(fid);
Related Question