필터 지우기
필터 지우기

Code Help for Matrix creation

조회 수: 1 (최근 30일)
Fayyaz
Fayyaz 2014년 7월 3일
댓글: Fayyaz 2014년 7월 3일
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
Image Analyst
Image Analyst 2014년 7월 3일
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?

댓글을 달려면 로그인하십시오.

채택된 답변

James Tursa
James Tursa 2014년 7월 3일
편집: James Tursa 2014년 7월 3일
A = (61312x2 matrix)
B = (81x81 matrix)
C = [A B(A(:,1)+81*(A(:,2)-1))]; % 3rd column uses linear indexing into B
  댓글 수: 3
Image Analyst
Image Analyst 2014년 7월 3일
Can you officially "accept" his answer also to give him points for privileges?
Fayyaz
Fayyaz 2014년 7월 3일
I've accepted the answer already. However if it is not the correct method, kindly let me know how to accept officially I will do that too :).

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by