Concatenate arrays into single cell array

1 visualización (últimos 30 días)
Tk
Tk el 19 de Jun. de 2019
Respondida: Tk el 19 de Jun. de 2019
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!

Respuesta aceptada

Tk
Tk el 19 de Jun. de 2019
Im stupid.
Its
myvec = 4:8;
mychar = 'M'
mycell = [mychar, num2cell(myvec)]

Más respuestas (0)

Categorías

Más información sobre Cell Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by