MATLAB: Somebody help me out the following code is throwing some error

this is the code
clc;
clear all;
imdataPositive={};
imgPath = 'D:\EDU\Project\Images\';
dCell = dir([imgPath '*.jpg']);
for a=1:length(dCell)
baseFileName = dCell(a).name;
fullFileName = fullfile(imgPath, baseFileName);
imdataPositive{a} =imread(fullFileName);
end
%for a=1:length(dCell)
%imageNames = {imdataPositive{a}};
%end
numImages = numel(imdataPositive);
emptyEntry = struct('image',[],'thumbnail',[]);
imageCollection = repmat(emptyEntry,[1 numImages]);
thumbnailSize = 400;
for i = 1:numel(imageCollection)
imageCollection(i).image = imread(imdataPositive{i});
imageCollection(i).thumbnail = imresize(imageCollection(i).image,...
[thumbnailSize,thumbnailSize]);
end
figure;
montage(cat(4,imageCollection.thumbnail));
title('Image Collection');
this is the error
??? Error using ==> strfind
Input strings must have one row.
Error in ==> imread at 329
if (strfind(filename, '://'))
Error in ==> test2 at 19
imageCollection(i).image = imread(imdataPositive{i});

Best Answer

Sai - I think that you are trying to do too many imreads. Note that you initialize imdataPositive as
for a=1:length(dCell)
baseFileName = dCell(a).name;
fullFileName = fullfile(imgPath, baseFileName);
imdataPositive{a} =imread(fullFileName);
end
where each element of imdataPositive is an image. Later in the code (at line 19), you try to do
imageCollection(i).image = imread(imdataPositive{i});
But imdataPositive{i} is already an image! All that you have to do is replace the above
imageCollection(i).image = imdataPositive{i};
Try the above and see what happens!