somebody help me out the following code is throwing some error?
Show older comments
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});
Accepted Answer
More Answers (1)
Image Analyst
on 4 Apr 2015
The code you posted does not have strfind() in it - only the error message does. My guess is that filename is empty, zero, or a 2D array. Put filename on it's own line without a semicolon before you call strfind() and see what it spits out to the command line.
filename
location = strfind(filename, '://')
if ~isempty(location)
% We found it!
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!