non zero elements in matrix

1 view (last 30 days)
Mo H
Mo H on 3 Apr 2020
Commented: Mo H on 3 Apr 2020
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

Accepted Answer

KALYAN ACHARJYA
KALYAN ACHARJYA on 3 Apr 2020
[r,c]=find(mat~=0)
  1 Comment
Mo H
Mo H on 3 Apr 2020
you are awesome

Sign in to comment.

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!