From: Juliette Salexa on
I'd like to get the vector:

['0000' ; '0100' ; '1000' ; '1100';
'0001' ; '0101' ; '1001' ; '1101';
'0010' ; '0111' ; '1011' ; '1111';
'0011' ; '0111' ; '1011' ; '1111']

from:

I0=['00' ;'01'; '10'; '11']

I0 =

00
01
10
11


It would be really nice if I could just do:
kron(I0,I0))

But matlab's is multiplying the ascii values (or something like that) rather than concatenating the strings !!

Is there a way to force the korneker product to work for my case ?
From: james bejon on
I'm not quite seeing how the vector you've typed equates to kron(IO, IO). Have you mistyped something, or am I just failing to understand what a kronecker does? (Quite likely the latter, but could confirm?)
From: james bejon on
Are you after something like

a = {'00'; '01'; '10'; '11'}
i = repmat(transpose(a), numel(a), 1);
j = repmat(a, 1, numel(a));
k = arrayfun(@strcat, i, j, 'Uni', 0);
From: Juliette Salexa on
"james bejon" <jamesbejon(a)yahoo.co.uk> wrote in message

Thanks James,

I realized I messed up that example:

It should have been:

['0000' ; '0100' ; '1000' ; '1100';
'0001' ; '0101' ; '1001' ; '1101';
'0010' ; '0110' ; '1010' ; '1110';
'0011' ; '0111' ; '1011' ; '1111']

which should be kron(I0,I0),

except, instead of multiplying the elements, I want to concatenate the strings.

Your example with cell arrays was exactly what I want to do, but I was avoiding cell arrays because I don't want to get something like:

k =

{1x1 cell} {1x1 cell} {1x1 cell} {1x1 cell}
{1x1 cell} {1x1 cell} {1x1 cell} {1x1 cell}
{1x1 cell} {1x1 cell} {1x1 cell} {1x1 cell}
{1x1 cell} {1x1 cell} {1x1 cell} {1x1 cell}

instead, I want to be able to see the entries all simultaneously and easily
From: Juliette Salexa on
Okay,

for i=1:4 for j=1:4 b{i,j}=cell2mat(k{i,j}); end; end;

Did the trick for me.

Thanks a lot for the code James!

But if anyone knows how to do this with KRON, I'd be very eager to learn it!