|
On 6/11/2012 1:08 AM, rohit wrote:
> can a string be asigned to a single element of matrix?
> like i have a string, a='i am there'
> then here 'a' is a vector of size 10.
> What i want is to assign this whole string into an element of a matrix.
> like say b(2,1) = a;
> is it possible?
a matrix in matlab is for numbers.
if you want to make a 'matrix' that contains not just
numbers but other stuff like string, try a cell array.
You can make cell matrix or cell vector.
EDU>> A=cell(10,1);
EDU>> a='micky mouse'
EDU>> A{2}=a
A =
[]
'micky mouse'
[]
[]
[]
[]
[]
[]
[]
[]
by the way, you said above
>here 'a' is a vector of size 10
then you wrote
>b(2,1) =
why? a vector is 1D not 2D.
--Nasser
--Nasser
|