Use cell array to get inputs

조회 수: 1 (최근 30일)
j
j 2015년 3월 31일
편집: j 2015년 4월 2일
I have one folder with subfolders and each of these subfolders contains files that I need to perform some function on, but I am struggling to figure out how to access the files. I am new to Matlab, so my logic is to get the names of these files and save the names in a cell array. Then, I would check to see if the cell array contains the name of my desired image file and somehow then have the file corresponding to the name be called and used an input for my function. Ideally, I would like to use an asterisk wildcard to choose all files with a certain word in their name (i.e. March, April, etc.) and use a loop to do something to each of these files).
The only thing that I have been able to do so far is to make a cell array containing all of the file names using test.m by Image Analyst. Can anyone please give me advice on how to proceed or if there is a better way to go through folders and subfolders and choose only certain files to perform a function on?

답변 (1개)

Ashish Uthama
Ashish Uthama 2015년 3월 31일
The new image batch processor app should make this task a lot simpler. (Also look at the 'Generate code' button to really understand what goes on under the hoods).
  댓글 수: 2
j
j 2015년 3월 31일
Thank you for your answer Ashish. However, I cannot directly load my image files into the image batch processor because they are not .PNG or .TIF files. I first want to select which images to use as inputs for my function (and not all of the images in my folder) and later I will convert them to a .PNG or .TIF file and use the image batch processor.
Ashish Uthama
Ashish Uthama 2015년 3월 31일
j, what format are your images in? I assume you have the corresponding read function. Maybe look at http://www.mathworks.com/help/matlab/ref/imformats.html to augment IMREAD to read your files? That would get them into the App.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by