Use a subset of number to find the index in a bigger set

3 Ansichten (letzte 30 Tage)
Reuben Addison
Reuben Addison am 2 Mai 2023
Kommentiert: Jon am 3 Mai 2023
I want to use a subset of number to find the index in a bigger set
eg bigger set BS = [2.33, 4.55, 5.88, 3.98, 4.66, 7.99, 2.33, 9.55]
smaller set SS = [4.55 4.66 7.99]
I want to use the smaller set (SS) to pick the inex of its location in the bigger set (BS)
I tried using find, ismember but not working well

Akzeptierte Antwort

Jon
Jon am 2 Mai 2023
BS = [2.33, 4.55, 5.88, 3.98, 4.66, 7.99, 2.33, 9.55];
SS = [4.55 4.66 7.99];
idx = find(ismember(BS,SS))
idx = 1×3
2 5 6

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by