|
On Oct 25, 3:51 pm, "Sris P" <nepalingrap...@yahoo.com> wrote:
> Hello,
>
> This might be a simple problem but I haven't been able to find any help online. Ok I have two arrays:
>
> A = [1 2 3 4];
> B = ['cat' 'dog' 'bird' 'cow'];
>
> what i want to do is something like this:
>
> AB = [1 2 3 4
> cat dog bird cow]
>
> but matlab is not letting me do this because one is a set of numbers and the other is a set of strings
>
> any help?
> cheers,
> S.
You may want to use cells:
a = {1 2 3 4};
b = {'cat' 'dog' 'bird' 'cow'};
ab = [a;b]
ab =
[ 1] [ 2] [ 3] [ 4]
'cat' 'dog' 'bird' 'cow'
For example, column 2 gives:
ab(:,2)
ans =
[2]
'dog'
Regards,
Enrique Vidal
|