2-D analogue to Sub...

Clear all

# [Solved] 2-D analogue to Subset( ) ?

Posts: 17
Moderator
Topic starter
Member
Joined: 1 year ago

I'm sharing a question a user asked me:

If you have a 1-D array of 1s and 0s (true and false), I know how to use Subset to get a list of the index items where the 1s occur. But what if I have a 2-D array (or more) or 1s and 0s -- is there a way for me to get a list of the coordinates where the 1s occur?

Topic Tags
Posts: 17
Moderator
Topic starter
Member
Joined: 1 year ago

Here is my solution:

   LocalIndex Ind := IndexesOf(A);    MdArrayToTable(A)[.Col=Ind] 

This is demonstrated in this model. There are other ways of doing it, and if you see another good way, feel free to add it to this thread.

Share:
Scroll to Top