Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

how to select image from a particular folder

Asked by Elysi Cochin on 13 Mar 2013

i wanted to select an image from a folder named dataset....

 [filename pathname]=uigetfile('*.tif','Select An Image');

when i do so, i have to select the Dataset folder and then the image from it.... what shud i do so that on execution itself the images will be displayed so that i neednt select on Dataset folder and then images

0 Comments

Elysi Cochin

Products

No products are associated with this question.

1 Answer

Answer by Walter Roberson on 13 Mar 2013
Accepted answer

Read the documentation.

FilterSpec can include a path. That path can contain '.','..', \, '/', or '~'. For example, '../*.m' lists all code files in the folder above the current folder.

9 Comments

Elysi Cochin on 13 Mar 2013

thank u sir... that was what i wanted exactly.... but if i copy the ProjectWork folder to another location... the path changes..... is it possible to do by coding.... even if i change the location of my "ProjectWork" folder i obtain the above result as u showed......

ProjectWork\Full_Project\Coding\Dataset'..... this remains the same..... can i do anything sir...

Walter Roberson on 13 Mar 2013

You can search your entire filesystem to try to find ProjectWork

Or, you can answer my earlier question "What directory are you cd'd to at the time you run the uigetfile() "

Image Analyst on 13 Mar 2013

What I do in that case (the folder you were expecting, say the folder you used last time you ran the program, cannot be found) is to bring up a file browse dialog box, like uigetdir() or uipickfiles, and have the user locate it.

Walter Roberson

Contact us