Concatenate arrays into single cell array

조회 수: 1 (최근 30일)
Tk
Tk 2019년 6월 19일
답변: Tk 2019년 6월 19일
Hi,
I have the a simple question:
I want to create a cell array which has various data types.
I want each element to be one number or character.
myvec = 4:8;
mychar = 'M'
mycell = {mychar, myvec}
mycell =
1×2 cell array
{'M'} {1×5 double}
How can I create the cell so that its a 1x6 cell array?
Thanks!

채택된 답변

Tk
Tk 2019년 6월 19일
Im stupid.
Its
myvec = 4:8;
mychar = 'M'
mycell = [mychar, num2cell(myvec)]

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by