matlab: 为什么我的程序中for循环只执行了一次? 谢谢
发布网友
发布时间:2024-03-07 00:07
我来回答
共1个回答
热心网友
时间:2024-06-14 02:10
试一下我的修改:
work_3(nmat); %多行两列的矩阵
A_1 = A(:,1);
A_2 = A(:,2);
s1 = numel(unique(A_2)); % length(unique(A_2));
count = hist(A_2,unique(A_2));
p = 1; k = 1; q = count(1);
D = work_5(A_1,p,q);
for j = 1:(s1-1)
if (length(D) >= 3)
output = D;
sprintf('%4d',output);
D = [];
p = k + count(j);
q = q + count(j+1);
D = work_5(A_1,p,q);
k = p;
else p = p; q = q + count(j+1);
D = [];
D = work_5(A_1,p,q);
k = k + count(j);
end
end