selecting image from only one folder
조회 수: 4 (최근 30일)
이전 댓글 표시
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
답변 (2개)
Joseph Cheng
2015년 2월 24일
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
Joseph Cheng
2015년 2월 25일
편집: Joseph Cheng
2015년 2월 25일
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!