error in matlab, cellfun, display image

1 vue (au cours des 30 derniers jours)
Tomas
Tomas le 26 Avr 2014
Modifié(e) : Tomas le 26 Avr 2014
Hello, i have a problem with cellfun
my code:
Z = cellfun(@(Z) Z', Z,'Un',0);
Z = cellfun(@(Z) cell2mat(Z), Z,'Un',0);
Z = cellfun(@(Z) sub2ind(size(I) , Z(:,1) , Z(:,2)), Z,'Un',0);
figure;
cluster = zeros(size(I));
for ii = 1:length(Z)
cluster(Z{ii}) = ii;
end
imshow(label2rgb(cluster))
title('Vystupny obraz - Metoda KMEANS','FontSize',16,'Color','k');
error:
??? Attempted to access Z(:,2); index out of bounds because size(Z)=[952,1].
Error in ==> KMNSimage>@(Z)sub2ind(size(I),Z(:,1),Z(:,2)) at 503
Z = cellfun(@(Z) sub2ind(size(I) , Z(:,1) , Z(:,2)), Z,'Un',0);
Error in ==> KMNSimage at 503
Z = cellfun(@(Z) sub2ind(size(I) , Z(:,1) , Z(:,2)), Z,'Un',0);
Z is :
Z={1x952 cell} {1x3141 cell} {1x3141 cell} {1x3141 cell}
know someone help ?
Thanks.

Réponses (0)

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by