How can I import all files from a folder in a loop and then work on them?
2 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!