If condition for all elements of array
古いコメントを表示
for i=1:n-2
for j=i+2:n
k_arr=i+1:j-1
for counter = 1:length(k_arr)
k = k_arr(counter);
if all(w(k)<(w(i)+((w(j)-w(i))*(t(k)-t(i))/(t(j)-t(i)))))
A(i,j)=1;
A(j,i)=1;
else A(i,j)=0;
A(j,i)=0;
end
disp('cycle completed');
end
end
In output I am expecting 1 only when if condition is true for all elements from k_arr(array) but it is giving output 1 even single element of array satisfy the condition. Please help me
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Set Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!