Error using plot - Vectors must be the same lengths.

1 次查看(过去 30 天)
Hi,
I got the error in the title of my question after running this part of code :
for i=1:size(X,3) % X is a MRI images sequence, it contains 30 images
ENDO = roipoly(size(X,1),size(X,2),XXendo(i,:),YYendo(i,:));
EPI = roipoly(size(X,1),size(X,2),XXepi(i,:),YYepi(i,:));
MYO = EPI-ENDO;
for j=1:6 % 6 is the number of myocardium sectors / segments
figure, plot((1:size(X,3)),(BW(:,:,j).*MYO))
end
end
The aim of this script is to plot the evolution of the 6 myocardium segments during the heart cycle (equivalent to 30 images).
ENDO is the endocardium, all the values inside it are equal to 1 and the values outside are equals to 0.
EPI is the endocardium, all the values inside it are equal to 1 and the values outside are equals to 0.
The size of BW is 162x174x6 and the size of MYO is 162x174. How can I fix this problem ?
Thank you for your help !

采纳的回答

Andrei Bobrov
Andrei Bobrov 2012-6-8
Please try EDIT2
n = size(X);
for i1=1:n(3) % X is a MRI images sequence, it contains 30 images
ENDO = roipoly(n(1),n(2),XXendo(i1,:),YYendo(i1,:));
EPI = roipoly(n(1),n(2),XXepi(i1,:),YYepi(i1,:));
MYO = EPI-ENDO;
for j1=1:6 % 6 is the number of myocardium sectors / segments
figure,imshow(BW(:,:,j1).*MYO);
end
end

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by