Here is a simple and neat solution, using Matlab's arrayfun function, which applies a function to each element of an array.
array1=[1,6,2,3,7];
array2=[3,6];
arrayfun(@(x)find(array1==x,1),array2)
The output is: ans =
4 2
Building Blocks for Financial Quant Skills
array1=[1,6,2,3,7];
array2=[3,6];
arrayfun(@(x)find(array1==x,1),array2)
The output is: Quant Lego Designed by PSD Style © 2011 All Rights Reserved.
0 comments:
Post a Comment