Write a for loop that converts the Data (Data.data) in the text file into matrix of 13 by 31 or 31 by 13.
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
The data should be imported and converted into a matrix of 13 x 31.
0 Kommentare
Akzeptierte Antwort
DGM
am 12 Apr. 2022
This should be one way:
alltext = split(fileread('Textfile.txt'),newline);
allnums = regexp(alltext(1:end-1),'(?<=:\s*)[+-E\d]+','match');
allnums = cellfun(@str2double,allnums);
allnums = reshape(allnums,13,[])
2 Kommentare
DGM
am 12 Apr. 2022
for k = 1
alltext = split(fileread('Textfile.txt'),newline);
allnums = regexp(alltext(1:end-1),'(?<=:\s*)[+-E\d]+','match');
allnums = cellfun(@str2double,allnums);
allnums = reshape(allnums,13,[])
end
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Type Identification 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!