Matrix that contains both numbers and strings?

  • Follow


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!
0
Reply Catalin 5/6/2010 10:59:05 AM

"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
0
Reply Sean 5/6/2010 11:56:05 AM


1 Replies
303 Views

(page loaded in 0.019 seconds)

Similiar Articles:













7/25/2012 4:43:21 PM


Reply: