Finding the index (rank) of a specific number from a column
1 次查看(过去 30 天)
显示 更早的评论
Suppose I have a column B = [ 1 4 8 3 5 9]
and I have another vector = [ 8]
In this case, I want to find the rank where it's matched in the vector which should return a value of 3 (3rd). How do I do that ?
3 个评论
采纳的回答
Walter Roberson
2018-12-10
[~, idx] = ismember(8, B)
3 个评论
Walter Roberson
2018-12-10
just_a_variable = 8;
[~, rank_that_you_are_looking_for_this_is_the_result_that_you_want] = ismember(just_a_variable, B);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!