finding column # that contains an integer in a matrix
조회 수: 5 (최근 30일)
이전 댓글 표시
hi,
I want to find indices of columns of a matrix which contains a specific integer.
say magic(5), how can I find column numbers that has got '5' in it if it exists!
thanks,
Mehrdad
댓글 수: 0
채택된 답변
James Tursa
2015년 7월 7일
편집: James Tursa
2015년 7월 7일
X = your matrix;
indices = find(any(X==5)); % columns that have the number 5 in them
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!