plot - plotting from a loop in matlab -
i strange problem in matlab code, part of code:
for k=1:length(box11) num_pts1(k)=sum(length(find(box11(:,k)>0))); size1=sum(length(find(box11(:,:)>0))); perc1(k)=(num_pts1(k)/size1)*100; end plot(delta,perc1(k),'*')
however, problem perc1 fixed in plot. see straight line in graph. have different numbers give curve line me.. plzzzzzzzzzzzzzzzz, :( !!!
you should recall length
returns length of array. so, in instruction
num_pts1(k)=sum(length(find(box11(:,k)>0)));
the operator sum
acts on scalar (which equals length of array find(box11(:,k)>0)
), , not on array. same holds true instruction
size1=sum(length(find(box11(:,:)>0)));
so, if length of find(box11(:,k)>0)
not change k
, perc1
keep constant.
Comments
Post a Comment