double - type matrix with integer and char values

조회 수: 3 (최근 30일)
Francesco
Francesco 2014년 6월 2일
댓글: Star Strider 2014년 6월 2일
Hi, I would know if it's possible create a matrix with two columns where in the first one we have integer values while in the second one i would save character values. Thanks for the answers.

채택된 답변

Star Strider
Star Strider 2014년 6월 2일
편집: Star Strider 2014년 6월 2일
You can easily do that with a cell array, but not a matrix. Matrices have to have only one data type.
For instance:
for k1 = 1:10
C{k1,1} = k1;
C{k1,2} = char(61+k1);
end
The character array can be anything you want (single letters or symbols here only for demonstration purposes).

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by