how to find index of matrix
2 views (last 30 days)
Show older comments
A=[1 8.5714 9.6250
2 8.5714 9.7500
3 8.5714 9.8750
4 8.5714 10.0000
5 8.7857 5.0000
6 8.7857 5.2500
7 8.7857 5.5000
8 8.7857 5.7500
9 8.7857 6.0000
10 8.7857 6.2500
11 8.7857 6.5000
12 8.7857 6.7500
13 8.7857 7.0000
14 8.7857 7.2500
15 8.7857 7.5000
16 8.7857 7.7500
17 8.7857 8.0000
18 8.7857 8.2500
19 8.7857 8.5000
20 8.7857 8.7500
21 8.7857 9.0000
22 8.7857 9.2500
23 8.7857 9.5000
24 8.7857 9.7500
25 8.7857 10.0000
26 9.0000 5.0000
27 9.0000 5.1250
28 9.0000 5.2500
29 9.0000 5.3750
30 9.0000 5.5000
31 9.0000 5.6250
32 9.0000 5.7500
33 9.0000 5.8750
34 9.0000 6.0000
35 9.0000 6.1250
36 9.0000 6.2500
37 9.0000 6.3750]
hi
I need to find the index of matrix A withe to have A=(:,1)=9 and A(:,2)=5.125
i try this
[row,col]=find (A(:,1)==9 && A(:,2)=5.125)
i need to have a sresult equal 27
1 Comment
Answers (2)
the cyclist
on 30 Nov 2020
It looks like you were checking the wrong columns.
row = find (A(:,2)==9 & A(:,3)==5.125)
Also, you need to use & rather than &&.
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!