How to quickly find the indecies of elements in an array?
    7 次查看(过去 30 天)
  
       显示 更早的评论
    
Dear All,
I have an array A which contains integers. I have another array B. I want to find out the indecis of B in A. 
For example, A = [1 9 2 8 3 7 4 6 5], B = [5 6 7]. The indecis of B in A is [9 8 6]. 
Thanks.
Benson
0 个评论
采纳的回答
  per isakson
      
      
 2021-5-23
        
      编辑:per isakson
      
      
 2021-5-23
  
      A = [1 9 2 8 3 7 4 6 5];
B = [5 6 7];
[~,ix] = ismember( B, A )
0 个评论
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


