??? Assignment has more non-singleton rhs dimensions than non-singleton subscripts

9 visualizaciones (últimos 30 días)
% my array declaration
imgarr=zeros([5,3,nFrames]);
% Create topleft quantized image
[img1,map] = rgb2ind(tl,64);
% color planes for topleft image
tl_rPlane = reshape(map(img1+1,1),size(img1)); % Red color plane for image
tl_gPlane = reshape(map(img1+1,2),size(img1)); % green color plane
tl_bPlane = reshape(map(img1+1,3),size(img1)); % blue color plane
imgarr(1,1,k)=imhist(tl_rPlane); % storing histograms for the 3 color planes to the kth dimension of the array..
imgarr(1,2,k)=imhist(tl_gPlane);
imgarr(1,3,k)=imhist(tl_bPlane);
my error:
??? Assignment has more non-singleton rhs dimensions than
non-singleton subscripts
Error in ==> modified at 42
imgarr(1,1,k)=imhist(tl_rPlane);
i need to store the histogram values of the three color planes to the array please do help me...im totally a newcomer to matlab...
[EDITED, Jan, code formatted]

Respuesta aceptada

Jan
Jan el 28 de Dic. de 2012
imhist replies a vector, but imgarr(1,1,k) is a scalar, if k is scalar. Perhaps you want imgarr to be a cell array:
imgarr = cell(5,3,nFrames);
...
imgarr{1,1,k} = imhist(tl_rPlane);
You can store only vectors of the same length in an numerical array, but in a cell array all elements can have different type and size. As a drawback, it is much harder to perform calculations with cell arrays, of course.

Más respuestas (0)

Categorías

Más información sobre Images en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by