Additionally, the 10000 files have a common extension .xls and different names. However, the names are numerical and increase sequentially by a factor of 1 e.g 001.xls, 002.xls etc.
Indexing several Data files to extract a column from each file
2 次查看(过去 30 天)
显示 更早的评论
Hello,
I have 10000 different *.xls files. I have imported them to my workspace and would like to extract only column 3 from each of the 10000 files. Each file has 10 columns.
Having extracted the 3rd column from each file, I would like to preallocate a matrix where the 10000 columns would be stored as my output file.
Assume that my file has length(15000) as it contains daily precipitation timeseries for a long period.
I appreciate your response.
Zilefac.
3 个评论
Matt J
2012-10-18
Clarify what "length(15000)" means. Is it the number of rows in the desired output?
采纳的回答
Azzi Abdelmalek
2012-10-18
编辑:Azzi Abdelmalek
2012-10-18
A=zeros(15000,1000);
for k=1:1000
filename=sprintf('file%d.xls',k)
num=xlsread(filename)
A(:,k)=num(:,2)
end
0 个评论
更多回答(1 个)
Sachin Ganjare
2012-10-18
With xlsread command you can read partcular column in xls file.
Below link will be useful in this regard:
Hope it helps!!!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!