Add label to TXT file
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
i'm using this command to create a .txt of data. The data are placed in the first row. Is there a way to add fix labels in the first row and put the data in the second row? Thanks a lot for any help.
dlmwrite('c:\data.txt', y, 'delimiter', '\t');
0 件のコメント
回答 (2 件)
Kevin Holst
2012 年 3 月 23 日
you could just add a simple fopen command prior to your dlmwrite command:
fid = fopen('c:\data.txt','w');
fprintf(fid,'H2 CO CO2 Ar');
fclose(fid)
dlmwrite('c:\data.txt',y,'-append','delimiter','\t');
0 件のコメント
Giuseppe Bregliozzi
2012 年 3 月 23 日
1 件のコメント
Kevin Holst
2012 年 3 月 23 日
The intent was for you to replace 'Your Text Here' with the line that you're wanting. In this case my understanding is that you would want fprintf(fid,'H2 CO CO2 Ar');
I've adjusted my answer accordingly.
参考
カテゴリ
Help Center および File Exchange で Data Import and Export についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!