Code Help for Matrix creation
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Fayyaz
el 3 de Jul. de 2014
Comentada: Fayyaz
el 3 de Jul. de 2014
Hello.
I have two matrices. 1st order is 61312*2 (two columns i.e. origin and destination, values ranges from 1 to 81 in both columns). 2nd matrix is 81*81 (include length between origin and destination)
Now I need to create a matrix having order 61312*3 i.e origin*destination*length, i.e. to write a code which take the value from 2nd matrix (length) for their respective values in 1st matrix.
Kindly let me know how should I proceed.
1 comentario
Image Analyst
el 3 de Jul. de 2014
Can you give a small example. Also, what does this have to to with the Coder product? Do you need to translate this into C to embed it in silicon or something?
Respuesta aceptada
James Tursa
el 3 de Jul. de 2014
Editada: James Tursa
el 3 de Jul. de 2014
A = (61312x2 matrix)
B = (81x81 matrix)
C = [A B(A(:,1)+81*(A(:,2)-1))]; % 3rd column uses linear indexing into B
3 comentarios
Image Analyst
el 3 de Jul. de 2014
Can you officially "accept" his answer also to give him points for privileges?
Más respuestas (0)
Ver también
Categorías
Más información sobre MATLAB Coder 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!