Import column from files
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Matt J
on 12 Jul 2013
A=zeros(1507,196);
for i=3201:3396
filename=[num2str(i) '.raw'];
A(:,i) = dlmread(filename,'',[5,1,1511,1]);
end
2 Comments
Matt J
on 12 Jul 2013
Edited: Matt J
on 12 Jul 2013
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.
See Also
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!