how to display an array with its position
显示 更早的评论
i have an array such as X=[1 2 3 4 5 6 7 8 8 7 8 6 4 5 3 1]
i want to display the output as X(1)=1 X(2)=2
1 个评论
madhan ravi
2019-8-11
编辑:madhan ravi
2019-8-11
Isn't this the same idea as your previous question??
回答(1 个)
SYED IMTIAZ ALI SHAH
2019-8-11
x(1) % it gives you the entry at location 1
x(2) % it gives you the entry at location 2
c = find(x == 2) % gives you the position of 2 in array.
类别
在 帮助中心 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!