how to append matrix value from lookup list
조회 수: 2 (최근 30일)
이전 댓글 표시
I have the following matrix A =
0 34.5 10 3 22.753 8.9632
0 34.5 10 7 22.753 8.9632
0 68.9 10 3 22.753 8.9632
0 68.9 10 7 22.753 8.9632
0 137.9 10 3 22.753 8.9632
0 137.9 10 7 22.753 8.9632
0 206.8 10 3 22.753 8.9632
0 206.8 10 7 22.753 8.9632
0 275.8 10 3 22.753 8.9632
0 275.8 10 7 22.753 8.9632
10 34.5 10 3 22.753 8.9632
10 34.5 10 7 22.753 8.9632
10 68.9 10 3 22.753 8.9632
10 68.9 10 7 22.753 8.9632
10 137.9 10 3 22.753 8.9632
10 137.9 10 7 22.753 8.9632
10 206.8 10 3 22.753 8.9632
10 206.8 10 7 22.753 8.9632
10 275.8 10 3 22.753 8.9632
10 275.8 10 7 22.753 8.9632
I want to insert a new column to the right containing values from the following lookup list
B =
0 34.5 328.5
0 68.9 415.6
0 137.9 589.6
0 206.8 727.9
0 275.8 856.1
10 34.5 307.4
10 68.9 362
10 137.9 541.6
10 206.8 695.6
10 275.8 856.1
20 34.5 263.9
20 68.9 337.5
20 137.9 503.8
20 206.8 635.3
20 275.8 749
30 34.5 224.9
30 68.9 297.4
30 137.9 437.9
30 206.8 573.9
30 275.8 673.1
The values in the new columns in A is based on the lookup list of B.
Manually, I would expect something like this
C =
0 34.5 10 3 22.753 8.9632 328.5
0 34.5 10 7 22.753 8.9632 328.5
0 68.9 10 3 22.753 8.9632 415.6
0 68.9 10 7 22.753 8.9632 415.6
0 137.9 10 3 22.753 8.9632 589.6
0 137.9 10 7 22.753 8.9632 589.6
0 206.8 10 3 22.753 8.9632 727.9
0 206.8 10 7 22.753 8.9632 727.9
etc...
Notice the last column of C is based on the values in A column 1 and 2 which is matched with the lookup list in B column 1 and 2.
Can anyone help me.
댓글 수: 2
Jan
2016년 11월 23일
편집: Jan
2016년 11월 23일
So actually only the 2 first columns of A matter, right? How is the lookup table used: choose the nearest 2 elements, choose at exact match (what is dangerous for floating point values), linear interpolation? What should happen to the elements, which are not found in B?
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!