Write a for loop that converts the Data (Data.data) in the text file into matrix of 13 by 31 or 31 by 13.
1 次查看(过去 30 天)
显示 更早的评论
The data should be imported and converted into a matrix of 13 x 31.
0 个评论
采纳的回答
DGM
2022-4-12
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 个评论
DGM
2022-4-12
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!