Info
This question is closed. Reopen it to edit or answer.
Error with the creation of vectors
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Walter Roberson
on 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 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!