how to append matrix value from lookup list
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
BeeTiaw
el 23 de Nov. de 2016
Comentada: BeeTiaw
el 23 de Nov. de 2016
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 comentarios
Jan
el 23 de Nov. de 2016
Editada: Jan
el 23 de Nov. de 2016
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?
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!