How to assign numbers
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi all I have got a table where I want to assign number bigger than the highest number already there in the table to the ones assigned zero. How can I do that.
댓글 수: 5
Guillaume
2019년 8월 6일
@madhan,can you write that as an answer? I don't think it can be done any simpler.
채택된 답변
추가 답변 (1개)
Joel Handy
2019년 8월 6일
Something like this?
table = randi([0 10],10,10);
tableMax = max(max(table));
table(table==0) = tableMax+1;
% Or Just
table(table==0) = Inf;
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!