필터 지우기
필터 지우기

Can I combine letters with numbers in the same matrix?

조회 수: 3 (최근 30일)
M
M 2022년 8월 23일
댓글: Steven Lord 2022년 8월 23일
Can I combine letters with numbers in the same matrix?
I have vector B return two letters for example [L M]
And another vector O returns two numbers for example [1 2]
Can I combine them to be like this?
[L M
1 2]

채택된 답변

Rik
Rik 2022년 8월 23일
You have these options:
{'L','M';1,2}
ans = 2×2 cell array
{'L'} {'M'} {[1]} {[2]}
["L","M";"1","2"]
ans = 2×2 string array
"L" "M" "1" "2"
['L','M';1,2]
ans = 2×2 char array
'LM' ''
double(['L','M';1,2])
ans = 2×2
76 77 1 2
  댓글 수: 1
Steven Lord
Steven Lord 2022년 8월 23일
Another option:
T = table(['L'; 'M'], [1; 2])
T = 2×2 table
Var1 Var2 ____ ____ L 1 M 2
T(1, :)
ans = 1×2 table
Var1 Var2 ____ ____ L 1

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by