Labeled rows and column in a matrix

조회 수: 7 (최근 30일)
Shima Asaadi
Shima Asaadi 2016년 3월 14일
답변: MHN 2016년 3월 14일
I would like to create a matrix with labeled rows and columns. Then use the labels to fill in the Matrix. For example: the first row of matrix A is word1 and the third column of A is word3. I want to value A(word1,word3)=1.5 . sometimes I need numerical index of rows/columns (like a normal matrix) and sometimes the labels. I tried container.map, but it does not have numerical index! Which structure would you suggest?
Thanks, Shima
  댓글 수: 2
Stephen23
Stephen23 2016년 3월 14일
편집: Stephen23 2016년 3월 14일
Why not just use containers.map and keep a list of the keys in a cell array. You can use indexing directly on the cell array to get the keys that you need, and then apply the keys to the map object.
Or perhaps a table might be more suitable.
Kirby Fears
Kirby Fears 2016년 3월 14일
The table structure works here.

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

채택된 답변

MHN
MHN 2016년 3월 14일
Use table instead.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by