Error with the creation of vectors
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
Dear colleagues,
I need to calculate the relation of mean intensity of exterior border of regions between mean intensity of inside of regions . This regions are identified in a labels matrix called L. The number of regions is num=47.
For this purpose, I put in Matlab the following sentences:
pborde=strel('disk',3);
for k=1:num
M=zeros(1960,1960); Matriz with size equal to original matriz
M(L==k)=1; %L is the label matriz with all regions of my image
pborde2(k)=imdilate(M,pborde);
Bext(k)=M-pborde2(k);
Bext(k)=double(Bext(k));
p2ext(k)=regionprops(Bext(k),yb,'MeanIntensity');
vp2(k)=p2intr(k).MeanIntensity./p2ext(k).MeanIntensity;
end;
p2= vp2';
But Matlab gives me the following mistake "In an assignment A(I) = B, the number of elements in B and A must be the same". It seem that doesn´t made the vector. But this mistake is produced also if I put only this sentence:
for k=1:num
M=zeros(1960,1960);
M(L==k)=1;
end
What is the problem?
Thank you very much in advance
Réponses (1)
Walter Roberson
le 9 Nov 2011
You would get that error if size(L) is not the same as size(M) -- and if you want the two to be the same size for sure then use
M = zeros(size(L));
8 commentaires
Cristina
le 10 Nov 2011
bym
le 10 Nov 2011
what do you get when you do size(L) in the command window?
bym
le 10 Nov 2011
how did you create L? was it L = bwlabel(bw,n)?
Cristina
le 10 Nov 2011
Walter Roberson
le 10 Nov 2011
What error message does MATLAB give?
Cristina
le 10 Nov 2011
Cristina
le 10 Nov 2011
Cristina
le 10 Nov 2011
Cette question est clôturée.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!