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!