Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
how to select matrix from many random matrix?
조회 수: 1 (최근 30일)
이전 댓글 표시
if i write this code
for k=1:25
x = randi([0 1],5,5);
val = sum(sum(x))
end
the result will be 10 matrices that have the Minimum Val from the 25 Matrices
- i need the Matrix not the value for matrices
댓글 수: 0
답변 (1개)
Walter Roberson
2016년 5월 3일
Matrix = randi([0 1],5,5);
bestval = sum(Matrix(:));
for k = 2 : 25
x = randi([0 1],5,5);
val = sum(x(:));
if val < bestval
Matrix = x;
bestval = val;
end
end
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!