I am trying to use dlmwrite. My foo.obs has 3 rows of text before my data starts: 2 lines of title, and then my header line. I want each line to start at a new line, but then my header line to be tab delimited.
I don't want to use \n as it will cause a ^M to show up when I open the file on Unix.
The following code almost does that, expect that my headers also goes into different lines. I want all my header in the same line and tab delimited.
fnam='foo.obs';title1 = {'Line 1'};title2= {'Here is a new line'};hdr={'H1','H2','H3'};txt=sprintf('%s\n',title1{:},title2{:},hdr{:});txt(end)='';dlmwrite(fnam,txt,'');
Any ideas would be greatly appreciated.
Thanks
Best Answer