Azzera filtri
Azzera filtri

error in matlab, cellfun, display image

1 visualizzazione (ultimi 30 giorni)
Tomas
Tomas il 26 Apr 2014
Modificato: Tomas il 26 Apr 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.

Risposte (0)

Categorie

Scopri di più su Programming in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by