Azzera filtri
Azzera filtri

Reading huge number of excel files in a loop

1 visualizzazione (ultimi 30 giorni)
Siddhant Chandra
Siddhant Chandra il 7 Ago 2018
Risposto: dpb il 8 Ago 2018
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 Commento
jonas
jonas il 7 Ago 2018
Modificato: jonas il 7 Ago 2018
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.

Accedi per commentare.

Risposte (1)

dpb
dpb il 8 Ago 2018
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.

Community Treasure Hunt

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

Start Hunting!

Translated by