link multiple data files

4 visualizzazioni (ultimi 30 giorni)
wendy klein
wendy klein il 31 Mag 2011
Obviously new to MATLAB.. I have written a script & would like to run the script on multiple files without inputting a new file name each time. Thanks

Risposte (2)

Laura Proctor
Laura Proctor il 31 Mag 2011
If all of the files live in the same directory, you can use the LS command. See below for a couple examples:
a = ls;
a = ls('C:\class\*.m');
This will return a char array that you can convert into a cell array using CELLSTR:
b = cellstr(a);
Then, run through your script with each file name contained in the cell array.
  2 Commenti
wendy klein
wendy klein il 2 Giu 2011
Thanks,
Is 'C:\class\*.m' the current folder?
wendy klein
wendy klein il 2 Giu 2011
Using the above it seems I still have to input each individual file in my script

Accedi per commentare.


Walter Roberson
Walter Roberson il 31 Mag 2011
Please see this FAQ

Categorie

Scopri di più su Variables in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by