Set path or Add path in MATLAB

83 ビュー (過去 30 日間)
Chethan
Chethan 2013 年 6 月 13 日
コメント済み: Walter Roberson 2020 年 4 月 26 日
I'm facing problem with managing directory in MATLAB. I'm working on CBIR, in this project I'm using uigetfile to get image files, these images must be stored in a folder from where i retrieve images and also must add this folder to directory/path, If that folder is not added to path and if i run program i get an error stating 'image.ext' does not exist'.
suppose if user want to search for similar images for his/her own query image and if he/she is not familiar with MATLAB they simply input query image from remote folder which was not added to folder. Then definitely he/she will get error.
Is there any way to get off from this?
  2 件のコメント
Navya Kudaravalli
Navya Kudaravalli 2020 年 4 月 26 日
How to resolve this error. Please help me with this
Thank you.
Walter Roberson
Walter Roberson 2020 年 4 月 26 日
loadMNISTimages is not a MATLAB function.

サインインしてコメントする。

回答 (2 件)

Jan
Jan 2013 年 6 月 13 日
編集済み: Jan 2013 年 6 月 13 日
Do not add folders to the PATH only to read some data files. Using the full path is much safer and quicker:
cd('C:\YourDefault\ImagePath');
[FileName, PathName] = uigetfile(*.jpg', 'Select an image file:');
if ~ischar(FileName)
disp('User pressed Cancel');
return; % Or what ever is applicable
end
File = fullfile(PathName, FileName);
img = imread(File);
More details can be found by: doc uigetfile

Vikash Kumar
Vikash Kumar 2013 年 6 月 13 日
One way is to give the full path of the image. Hope this helps.
  1 件のコメント
Chethan
Chethan 2013 年 6 月 13 日
what do you mean by full path of an image?

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by