matlab - index out of bounds error because numel -
matlab - index out of bounds error because numel -
it loops through until lastly time , error "attempted access eq_num(8); index out of bounds because numel(eq_num)=7."
n_node=8 n_pre_disp=2 disp_node= [2 7] eq_num = 0; = 1:n_pre_disp node=disp_node(i); eq_num(node) = -i; end row = 0; = 1:n_node if (eq_num(i)==0) row = row+1; eq_num(i)=row; end end
in loop
eq_num = 0; = 1:n_pre_disp node=disp_node(i); eq_num(node) = -i; end
you create eq_num
7 elements; highest value node
takes highest value in disp_node(1:2)
7
.
in loop
row = 0; = 1:n_node if (eq_num(i)==0) row = row+1; eq_num(i)=row; end end
you loop on i=1:8
, seek execute eq_num(8)==0
.
you need prepare something, don't know what. perchance think matlab arrays indexed 0, they're not, first index matlab array 1.
matlab
Comments
Post a Comment