How can i get a pathname with \*.jpg for an image folder.
4 次查看(过去 30 天)
显示 更早的评论
I am using
1. folder_name = uigetdir('C:\Users\Student\Documents\MATLAB\matlab program folder')
2. dirNamev =('C:\Users\Student\Documents\MATLAB\matlab program folder\9.15\*.jpg');
filesv = dir(dirNamev);
to get the folder name, but form 1---> it gives me only "C:\Users\Student\Documents\MATLAB\matlab program folder\9.15". 9.15 is a folder containing set of 11 images. My aim is to get a 11x1 struct as in --->form 2. I want to go for 1st method because the folder may change every time and user may need to make a change. Please help me with some ideas.
0 个评论
采纳的回答
Jan
2014-3-24
folder_name = uigetdir('C:\Users\Student\Documents\MATLAB\matlab program folder');
filesv = dir(fullfile(folder_name, '*.jpg'));
2 个评论
Marta Salas
2014-3-25
you can concatenate the character '\':
folder_name = [folder_name '\'];
or you can do:
fullfile(folder_name, filesv(1).name)
更多回答(1 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!