Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

compare a number to an other matrix

1 vue (au cours des 30 derniers jours)
Mo Das
Mo Das le 24 Mai 2019
Clôturé : MATLAB Answer Bot le 20 Août 2021
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 commentaires
Geoff Hayes
Geoff Hayes le 24 Mai 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
Mo Das
Mo Das le 24 Mai 2019
i have a formula that it uses 4 items . place that number in mat B is smaller than number in mat A.
smaller and bigger numbers in mat B .
and number in mat A has been compared with mat B. i want to get this items at the end . i tought matrix with 4 items must be perfect

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by