Finding all index for a given row and incrementing of every 10 indices - implement something like this and put it into a foreloop.

3 Ansichten (letzte 30 Tage)
Hello all,
If I had a martix of 5 by 10, and in each of the index(s) there are numbers that increment.
example:
row(1), col(all) = 1, 3, 6, 19, 20, 21, 50, ... so on
row(2), col(all) = 2, 5, 6, 15, 16, 30, 54, ... so on
:
:
so on
Then the indexes (1) and (5) which the values are 1 and 20. How do I implement something like this and put it into a foreloop.
Now I looked into find command for Matlab, but can't make sense of how to properly implement it into my code for finding two of the indexes like I explained above.

Antworten (1)

David Hill
David Hill am 5 Jun. 2020
idx=[find(ismember(a,1))',find(ismember(a,20))'];
  3 Kommentare

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by