Hi. Suppose I have the matrix A of size (m*n).
A = [12 44
93 43
128 44
145 41
180 41
220 40
280 40];
also I have the vector V e.g.
V = [13 20 70 90 95 100 102 110 129 130 145 158 170 185 190 200 207 220 270 280 285 290];
I want to find which one of the rows of matrix A based on its first column values is right after and right before the values of vector V, and if one of the values of the first column of matrix A is equal to the values of vector V, I want to find that row.
For example :
A(2,1) is right before V(5) and V(6) and V(7) and V(8)
A(3,1) is right after V(5) and V(6) and V(7) and V(8)
and in case of equality I want to find this
A(4,1) = V(11)
A(5,1) = V(18)
A(7,1) = V(20)
In other words, I want to find exactly which members of vector V are between which members of first column of matrix A with their indices like this :
V(1) and V(2) and V(3) and V(4) is between A(1,1) and A(2,1)
Thanks for your help.
2 Comments
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/365475-finding-the-values-right-after-and-right-before-some-values-in-a-matrix#comment_501842
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/365475-finding-the-values-right-after-and-right-before-some-values-in-a-matrix#comment_501842
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/365475-finding-the-values-right-after-and-right-before-some-values-in-a-matrix#comment_501846
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/365475-finding-the-values-right-after-and-right-before-some-values-in-a-matrix#comment_501846
Sign in to comment.