problem in assigning elements
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
hi, i'm developing a program to measure pupil diameter changes due to a light stimulus.
this is a part of my mfile
clear
video=input('insert video:');
v=aviread(video);
info=aviinfo(video);
n=info.NumFrames;
w=info.Width;
h=info.Height;
t=info.FramesPerSecond;
for a=1:n
p=v(a).cdata<19000;
p1=bwlabel(p);
stats(a) = regionprops(p1,'EquivDiameter');
end
my program works in this way: 1.acquire video 2.read the video frames 3.locate and calculate the pupil diameter(using the regionprops function)
but the problem is, sometimes a frame can yield more than one diameter value, which return error at the command "stats(a) = regionprops(p1,'EquivDiameter');"
here is the error message:
??? In an assignment A(:) = B, the number of elements in A and B must be the same.
Error in ==> pupil at 15 stats(a) = regionprops(p1,'EquivDiameter');
what i interpret from this error line is, my "stats(a)" variable can only contain 1 value of the "regionprops(p1,'EquivDiameter');" variable
What should i do to make my "stats(a)" variable able to contain more than 1 value from my "regionprops(p1,'EquivDiameter');" variable
Can anyone give me a clue / solution regarding this problem?
댓글 수: 0
답변 (1개)
Sean de Wolski
2011년 7월 20일
Define stats as a cell array
stats = cell(n,1);
for ii = 1:n
%do stuff
stats{ii} = regionprops(stuff)
end
댓글 수: 0
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!