How to set column and row index of .txt-file for the use of dlmwrite - text editor doesnt show the right column and row index
1 回表示 (過去 30 日間)
古いコメントを表示
Hello,
i have a problem concerning dlmwrite. I basically just want to write a matrix into a .txt file. Matlab recognizes the right number of column and rows when reading, the .txt editor however, doesnt. The editor fills up each row.
[FileName,PathName] = uigetfile('*.txt', 'Open text file','MultiSelect','on'); data = zeros(1043,2,length(FileName)) ;
for i = 1:length(FileName)
file = load(fullfile(PathName,FileName{i}));
data(:,:,i) = file;
end
data_mean=zeros(1043,2);
data_mean=mean(data(:,:,:),3);
dlmwrite('test.txt',data_mean,'delimiter',' ');
I hope I was specific and someone might know what my problem is. I just want to see the right number of columns and rows in the .txt editor
0 件のコメント
回答 (1 件)
Cris LaPierre
2018 年 11 月 20 日
It is likely the newline character is not being recognized. Consider adding a newline name-value pair to your dlmwrite command.
dlmwrite('test.txt',data_mean,'delimiter',' ','newline','pc');
It works for me (on a pc).
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Text Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!