Specify Folder Name with Variable for uigetfile
Show older comments
Hello again... learning a lot from these forums and thankful in advance :)
I am doing clinical research so I have a bunch of data for each research subject in their own folder. The subjects have numbers, but they are not necessarily sequential. Early in my script I have
subject_number = input('Enter subject number:','s');
I then want to import the names for a series of files from that folder that are in .jpg format.
Currently, I am doing this:
image1=('../*.jpg','select image 1');
image2=('../*.jpg','select image 2');
Is there any way that I can specify the folder that opens in the GUI by inputting the subject_number into that file path since subject_number is the name of the folder?
I have also tried this:
[image1 PathName]=uigetfile('','select image 1');
[image2 PathName]=uigetfile(PathName, 'select image 2');
That code is successful in opening up the folder where the previously chosen image was from on the 2nd call, but I can't see .jpg files.
This would save me a step, but more importantly make sure that I choose the files from the correct subject folder each time.
Thanks for your help! Molly
Accepted Answer
More Answers (0)
Categories
Find more on App Building in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!