Filter löschen
Filter löschen

Load many files in matlab

1 Ansicht (letzte 30 Tage)
alex
alex am 15 Mai 2013
Hi, I'm new to matlab and my english is not the best. I have a special data format called .sir which has picture data and header info in it. To load the data i already have a given function called loadsir.m:
[image, head, descrip, iaopt]=loadsir(filename)
To load a data into matlab i only have to write e.g. filename = 'queh-a-NAf00-001-004.sir'. Thats working great. But i have about 1000 of this datas in my directory. Somebody could give me a code to read them all in so i dont have to change the filename manually for every data?
Thanks a lot

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 15 Mai 2013
yourfolder='E:\answer\*.sir';
repertoir=dir(yourfolder);
files={repertoir.name}

Weitere Antworten (3)

Thomas
Thomas am 15 Mai 2013

alex
alex am 15 Mai 2013
Ok great, Thanks. Now i have a array with all the filenames in my directory right?
Using loadsir.m gives me this message now:
>> [image, head, descrip, iaopt]=loadsir(files) Error using fopen. First input must be a file name of type char, or a file identifier of type double.
Error in loadsir (line 143) fid=fopen(filename,'r','ieee-be');
Sorry, writing my bachelorthesis and dont have that much time to learn all the matlab basics :).

alex
alex am 15 Mai 2013
Ok sry. Used now:
[image, head, descrip, iaopt]=loadsir(files{1,100})
And it works! But he only saves the last array in [image] of course. How can i count up image,image1,image2 so that he saves them all in different arrays?

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by