selecting image from only one folder
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
can anyone teach me source code for selecting image only from one folder, example i have images on directory D:\TA\DR\, in folder DR i have 25 images, i have made a GUI, i want if i choose images from directry DR will be show on GUI, and if i choose images from non directory DR will be not shown on gui
thanks for helping me..
0 comentarios
Respuestas (2)
Image Analyst
el 24 de Feb. de 2015
Why would images from not in the DR folder show up on your GUI???
Joseph Cheng
el 24 de Feb. de 2015
so i'm assuming you're using something like this [file folder]=uigetfile('D:\TA\DR\');
you can put after that to string compare the result with your specific directory
if ~strcmp(folder,'D:\TA\DR\')
%error message or just don't do anything
else
%whatever you plan to do such as load image display the file in GUI, etc.
end
2 comentarios
Joseph Cheng
el 25 de Feb. de 2015
Editada: Joseph Cheng
el 25 de Feb. de 2015
so..... i don't see where the issue is. like i described in my example you are using uigetdir compare the folder (in your example nama_path) to the specified actual path. basically it is already there and add the additional check to the if statement to the if statement
if ~isequal(nama_file,0)&isequal(nama_file,whateverfolderyouwanted);
Are you asking for them not to be able to navigate away from the specified path? because then the method that i described only would not let them load files outside the zone. If you only want specific files from a specific place you're better off building a separate gui that you pop up with a listbox that you can populate with all the files listed with those extensions. I wouldn't hard code the file names in but you can get all the file names with the dir function and use a loop to populate the files they can select from.
Ver también
Categorías
Más información sobre File Operations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!