Reading huge number of excel files in a loop

1 回表示 (過去 30 日間)
Siddhant Chandra
Siddhant Chandra 2018 年 8 月 7 日
回答済み: dpb 2018 年 8 月 8 日
Hi!
I have 1090 .csv files to read. What I am trying to accomplish is compare column 1 from each of those Excel files and then extract the elements common in that column across all the 1090 .csv files. Since MATLAB does not already have a function to intersect multiple vectors, I am using the MINTERSECT function I found here ( https://www.mathworks.com/matlabcentral/fileexchange/6144-mintersect-multiple-set-intersection ).
The problem I am encountering is that the number of arguments for this function is HUGE in my case! Even if it is a lot, I can definitely mention all the vector names in the argument, that's not difficult. But before doing that I need to read all the 1090 .csv files and extract the column 1 elements and store it in a different vector with a different name corresponding to each .csv file. I was trying to do this using a FOR loop but I am not able to do it.
Can someone please help? Please let me know if you need any more clarification from me.
  1 件のコメント
jonas
jonas 2018 年 8 月 7 日
編集済み: jonas 2018 年 8 月 7 日
Why were you not able to do it with a for loop? You don't have to keep all files in the memory if that's the problem (as implied by huge in title). You can intersect them in batches.

サインインしてコメントする。

回答 (1 件)

dpb
dpb 2018 年 8 月 8 日
All that function is is a loop around intersect one vector at a time; that's all you need must do, there's no need to put all the variables into the argument list at all, just start with the first and rinse and repeat 'til done.

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by