finding the position of a number?
1 次查看(过去 30 天)
显示 更早的评论
a=[1 2 3;4 5 6] b=2 i should compare b with all elements of a and to find the corresponding position in a ... e.g., the answer should be (1,2). what command or what method should i use
0 个评论
采纳的回答
Youssef Khmou
2013-3-27
编辑:Youssef Khmou
2013-3-27
try this way
a=[1 2 3;4 5 6]; b=2;
[x,y]=find(a==b);
A=[x,y];
1 个评论
Image Analyst
2013-3-27
I wouldn't call it x,y - I'd call it row, column. Because usually x is the column (horizontal location), not the row as you have it.
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!