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!