Info
This question is closed. Reopen it to edit or answer.
compare a number to an other matrix
1 view (last 30 days)
Show older comments
A=[ 0.2230 0.2769 0.4342 0.5916
0.8142 1.0223 1.2754 1.5220
3.4634 4.0496 4.6448 4.9931
4.0816 4.6988 5.3160 5.5607
4.6499 5.2839 5.9179 6.0586
5.1968 5.8464 6.4960 6.4960]
B=[ 1.8189 2.5984 3.7677 5.3267 5.7165 6.4960 ]
i have 2 matrixes A and B. i want to write a loop to compare number from mat A in each row to mat B that the number is between 2 number in matrix B.
for example in mat A , a31 = 3.4634 and it is between b12 ans b13 .
so i have a third matrix with 4 items .
[ 2 (where the A number is bigger than B number ) 2.5984 ( smaller number in mat B) 3.7677 (bigger item in mat B) 3.4634(number that compared from mat A to mat B)]
i dont know i say clear or not . i dont know how to write the loop and how to put the numbers in the third matrix . :(
2 Comments
Geoff Hayes
on 24 May 2019
Mo - why just four items in the third matrix? Wouldn't there be 5? Numbers between
1.8189 2.5984
2.5984 3.7677
3.7677 5.3267
5.3267 5.7165
5.7165 6.4960
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!