How do I loop through csv files in Matlab?
-
I wrote a code to do something for a csv file full of data. The problem is that I need to do the same thing for 49 different files. My advisor told me I can loop through all 49 csv files and not have to copy and paste the code 49 times. I tried to loop through the files but I can't figure it out. Here is the code that I wrote so far: for f=[1:length(filenames)]; %filenames is the array with all the filenames f=0; f=f+1; y=csvread(filenames(f),2) I keep getting an error message saying that the filename must be a string. In the filenames array, I did address it as being a string. I don't get this. Any help is greatly appreciated.
-
Answer:
Change numbers to strings with function num2str. Try this concept: for ix = 1 : 3 filename = ['name' num2str(ix)] end
Annonymo... at Yahoo! Answers Visit the source
Related Q & A:
- How do I loop through many files in one folder?Best solution by thespreadsheetguru.com
- How do I loop through a string in R?Best solution by Stack Overflow
- How can I open the attached files?Best solution by Yahoo! Answers
- How can I send big music files from my computer to my friends by email?Best solution by Yahoo! Answers
- How do I change .3gp video files to other video files, so I can open it up in Windows?Best solution by helpdeskgeek.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.