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
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Cris LaPierre
am 20 Nov. 2018
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 Kommentare
Siehe auch
Kategorien
Mehr zu Text Files finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!