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

19 views (last 30 days)
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

Accepted Answer

dpb
dpb on 18 Dec 2020
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;

More Answers (0)

Categories

Find more on Cell Arrays 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!