Matlab error Unable to perform assignment because the indices on the left side are not compatible with the size of the right side

Viewed 37

command 'rgb2ind' produces output in squared brackets [X, map] and I would like to save during each repetition data in those brackets. Unfortunately, if I do so, I get error message saying: "Unable to perform assignment because the indices on the left side are not compatible with the size of the right side. Error in GIF_creation (line 31) [A(1),map(1)] = rgb2ind((imread(imgName(1,:))),256);" I would like to ask you how to correct it so it save properties from this command in square brackets and I can use them later.

for i=1:20
    imgname(1,:) = char(a(1).name)
    [X(i), mapX(i)] = rgb2ind((imread(imgname(i,:)),256);
 end ;

Best regards Michal

0 Answers
Related