MATLAB: I am getting error “Conversion to cell from uint8 is not possible.” Can anyone please help in debugging this? Thank you for your time.

leukemia detection

segmented_images=cell(1,3);
rgb_label=repmat(pixel_labels,[1,1,3]);
for k= 1:nColors
colors=I;
colors(rgb_label ~=k)= 0;
segmented_images(k)=colors;%it's showing error in this line
end

Best Answer

segmented_images=cell(1,3);
did indeed define to be a cell array, but then you wrote
segmented_images(k)=colors;
segmented_images(k) is the index to a member of the cell array but colors is apparently an array of uint8; we don't have the definition of I. You're missing the cell array syntax, {}
Use
segmented_images(k)={colors};
or
segmented_images{k}=colors;
Related Question