MATLAB Answers

0

Error using imread>get_full_filename (line 566) File "PAT\NPatsmall\0.tif" does not exist.

Asked by abdallah serag on 18 Oct 2019 at 23:47
Latest activity Commented on by abdallah serag on 19 Oct 2019 at 2:28
good evening
i am new user for matlab so i try to collect images from many folder to get the DCT2, RGB histogram and indexed-color histogram features .
i got a error that file is not exist but i check it by my self it was there
i try to chang the file name but it make no diffrencese
this is the code
if any one can help
----------------------------------------------------------------------------
ind=0;
path=strcat('PAT\', www ,'\');
outputfile2=strcat(www);
outputfileName2=strcat(path,outputfile2);
outputfileName3=strcat(outputfile2);
for iiii=1:50 %loop over the 100 images in each category
iii = (jndex-1)*50 + iiii -1;
fileName1=strcat(num2str(iii,'%2d'),'.tif');
outputfile1=strcat(num2str(iii,'%2d'),'.feats');
fileName1=strcat(path,fileName1);
outputfileName=strcat(path,outputfile1);
%reading the image:
X= imread(fileName1);
Xg=rgb2gray(X);
------------------------------------------------------------------------------

  1 Comment

We recommend against using a variable named path as that is the name of an important MATLAB function.
We recommend that you use fullfile() instead of strcat() to construct file names.
outputfile2=strcat(www);
The strcat() part does not appear to be doing anything useful ? Is www a string array or a cell array of strings, or is it a character vector?

Sign in to comment.

1 Answer

Answer by Sulaymon Eshkabilov on 19 Oct 2019 at 0:37
 Accepted Answer

Hi Abdallah,
  1. All of your folders from which you are trying to get data/images are added to the search path of your matlab. If not, then you should add them, via the command: addpath()
  2. Make sure that your file names to be on a sequential order then your loop operation would work.
  3. Now your code is not complete yet.
Good luck.

  1 Comment

Sign in to comment.