필터 지우기
필터 지우기

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 CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by