Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Matrix that contains both numbers and strings?

Subject: Matrix that contains both numbers and strings?

From: Catalin Eberhardt

Date: 6 May, 2010 10:59:05

Message: 1 of 2

Hi everyone,

I know I once found a way to have both strings and numbers into a single matrix, for example

A = ['a' 'b' 'c'; 1 2 3]

..but I can't recall the "trick" that I used to do it. Obviously, if you try to define A like above, Matlab gets confused: while it doesn't give an explicit error (at least in R2010a), it then returns this:

A =

abc


Can anyone help? Many thanks in advance!

Subject: Matrix that contains both numbers and strings?

From: Sean

Date: 6 May, 2010 11:56:05

Message: 2 of 2

"Catalin Eberhardt" <longtalker@gmail.com> wrote in message <hru7dp$8ik$1@fred.mathworks.com>...
> Hi everyone,
>
> I know I once found a way to have both strings and numbers into a single matrix, for example
>
> A = ['a' 'b' 'c'; 1 2 3]
>
> ..but I can't recall the "trick" that I used to do it. Obviously, if you try to define A like above, Matlab gets confused: while it doesn't give an explicit error (at least in R2010a), it then returns this:
>
> A =
>
> abc
> 
>
> Can anyone help? Many thanks in advance!

a hint:
>> doc cell

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us