Import column from files
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I have 200 files with names starting from 3201.rad to 3396.rad, each files has header (5 lines of text), 1057 raw and 3 columns. I want to create a matrix with the second column of each file, without the header. Matrix with 1057 raw, 196 column.
Thank you in advance for your help!
M.
0 个评论
回答(1 个)
Matt J
2013-7-12
A=zeros(1507,196);
for i=3201:3396
filename=[num2str(i) '.raw'];
A(:,i) = dlmread(filename,'',[5,1,1511,1]);
end
2 个评论
Matt J
2013-7-12
编辑:Matt J
2013-7-12
Works fine for me, Momo. What version of MATLAB are you using and are you sure you're calling DLMREAD with 3 input arguments, like in what I posted?
The error message says it's trying to read row 1, field 5. It should not be doing that if you've called it with the 3rd argument.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Debugging and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!