why did i get this error "Error using == Matrix dimensions must agree " ?? with MATLAB 2013a while not with MATLAB 2010b
Afficher commentaires plus anciens
when i am using this function: -------------- function [Am Al Amm] = regionadjacency(L)
% Identify the unique labels in the image, excluding 0 as a label.
%labels = setdiff(unique(L(:))',0);
labels=unique(L(:))';
if isempty(labels)
warning('There are no objects in the image')
Am = [];
Al = {};
return
end
Am = zeros(max(labels)); % Allocate adjacency matrix
Amm = Am;
Al = cell(1, max(labels)); % and adjacency list.
% Strategy: Dilate each labeled region and use that as a mask on the
% original labeled image. This extracts the original region plus a one
% pixel wide section of any adjacent regions. This ends up in the image 'r'
% in the code below. We then find the unique labels in 'r' ensuring the
% label of the original region and 0 are not included in the label list.
% This forms a list of region labels that are adjacent to the original
% region. We then set the entries in the adjacency list and adjacency
% matrix accordingly.
for n = labels
r = zeros(size(L));
r = L(imdilate(L==n, ones(3)));
Al{n} = setdiff(unique(r(:)), [n 0]);
Am(n, Al{n}) = 1;
% Experimental: Get strength of 'adjacency' by counting No of pixels in
% neighbouring region that is adjacent
for m = Al{n}
Amm(n,m) = sum(r(:) == m);
end
end
------------
i get this error "Error using == Matrix dimensions must agree" for this line " Amm(n,m) = sum(r(:) == m);" when i am using MATLAB 2013a but not with 2010b, so what should i do especially i need to work with 2013a??
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Morphological Operations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!