Friday, December 5, 2014

creating csv with header text in matlab

The csvwrite function in matlab does not work well with the text. There is a table feature in the new matlab version. However, here is a quick way to create csv with text header in matlab

csvData = [Elev TPW SkinT SurfacePr dayyes' ProfType Uyear Umo Uhr latitude longitude];

header=['Elev,TPW,SkinT,SurfacePr,dayyes,ProfType, year, mo,HH, latitude,longitude'];
outid = fopen('SeeBor.csv', 'w+');
fprintf(outid, '%s', header);
fclose(outid);
dlmwrite ('SeeBor.csv',csvData,'roffset',1,'-append')

No comments: