how can store string and number in a matrix?

11 visualizaciones (últimos 30 días)
mehdi
mehdi el 30 de Jul. de 2013
i want to store string and numbers in a matrix for example store word 'matlab' in one cell and 'ver' & '12' in other cells

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 30 de Jul. de 2013
A={'matlab', {'ver',12}}

Más respuestas (1)

Evan
Evan el 30 de Jul. de 2013
Editada: Evan el 30 de Jul. de 2013
You can use a cell array for storing values of differing datatypes:
A = {'matlab' 'ver' 12}
You can also use a cell array to store regular arrays of different sizes:
B = {[3 6 4 2],eye(3);1:4,magic(5)}
For more on cell arrays, including how to access the elements of arrays stored within them, see here:

Categorías

Más información sobre Numeric Types en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by