MATLAB Answers

How can I read a set of images in a 1x6 cell array?

12 views (last 30 days)
James
James on 10 Sep 2019
Commented: Walter Roberson on 26 Dec 2019
How can I use the imread function ro read a set of images that is in a 1x6 cell array format?

  0 Comments

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 10 Sep 2019
Edited: Walter Roberson on 10 Sep 2019
nfiles = length(YourCellArray);
image_content = cell(nfiles,1);
for K = 1 : nfiles
image_content{K} = imread(YourCellArray{K});
end
Or more simply,
image_content = cellfun(@imread, YourCellArray, 'uniform', 0);

  7 Comments

Show 4 older comments
Walter Roberson
Walter Roberson on 25 Dec 2019
nfiles = length(x1{i} );
image_content = cell(nfiles,1);
for K = 1 : length(x1)
image_content{K} = skelImage(x1{i}(K)-2:x1{i}(K)+2, y1{i}(K)-2:y1{i}(K)+2);
end
jenifer Ask
jenifer Ask on 25 Dec 2019
I recive this error:
Index exceeds matrix dimensions.
Walter Roberson
Walter Roberson on 26 Dec 2019
You deleted the code showing how x1 and y1 are created.
We can deduce from the error message that at least one of the x1{i} or y1{i} values is either 1 or 2, or else the last possible value or the last minus 1. Under those circumstances subtracting 2 or adding 2 could be out of range.

Sign in to comment.

Sign in to answer this question.

Products


Release

R2019a