Info

此问题已关闭。 请重新打开它进行编辑或回答。

compare a number to an other matrix

1 次查看(过去 30 天)
Mo Das
Mo Das 2019-5-24
关闭: MATLAB Answer Bot 2021-8-20
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 个评论
Geoff Hayes
Geoff Hayes 2019-5-24
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 2019-5-24
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

回答(0 个)

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by