Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

compare a number to an other matrix

1 visualización (últimos 30 días)
Mo Das
Mo Das el 24 de Mayo de 2019
Cerrada: MATLAB Answer Bot el 20 de Ag. de 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 comentarios
Geoff Hayes
Geoff Hayes el 24 de Mayo de 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 el 24 de Mayo de 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

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by