フィルターのクリア

How can I import all files from a folder in a loop and then work on them?

3 ビュー (過去 30 日間)
Peter L.
Peter L. 2015 年 12 月 10 日
回答済み: khan 2015 年 12 月 10 日
I have about 3000 .raw images in a folder.
I need to open them all and convert in to matrix form and then do mean and standard deviation
to convert 1 image I have a function that works like this:
img1=openraw ('C\path\folder\img00001.raw')
how can I make it so that the loop will open all of them? I cannot see a way to make the path of the image part of the loop so that for example:
starting point: C\path\folder\img00001.raw
loop 1: C\path\folder\img00002.raw
loop2: C\path\folder\img00003.raw
etc etc.
please help
thanks!

回答 (1 件)

khan
khan 2015 年 12 月 10 日
F = dir('C\path\folder\*.raw');
for ii = 1:length(F)
imagesAll(:,:,ii) = openraw(F(ii).name);
end
But you have to be careful in image size. If they are not equal than you have to make them equal. Otherwise the matrix will give you an error.

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by