non zero elements in matrix

조회 수: 3 (최근 30일)
Mo H
Mo H 2020년 4월 3일
댓글: Mo H 2020년 4월 3일
Hello,
I have a matrix 50*50 and every single elements has a value of either '0' or '1' . How can I determine all locations of all non zero elements. It would be nice if I could store the location in an array or something easy to read and understand.
Thank you

채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2020년 4월 3일
[r,c]=find(mat~=0)
  댓글 수: 1
Mo H
Mo H 2020년 4월 3일
you are awesome

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by