MATLAB: How to assambly two cells without for loop

assemblingcell arrayswithout for loop

Hello everybody,
I have an issue with the following: I have two cell arrays one is in a size of 24×1 (say UU1)and the other one is 8×1 (say UU2). I want to assamble these two in a third cell array with the size of 32×1 (say UU) without a for loop. It should look something like
UU{nodes1}=UU1; UU{nodes2}=UU2;
but could not do it 🙁 Any help appreciated, thank you 🙂

Best Answer

  • n1=numel(uu1)
    n2=numel(uu2)
    Out=cell(1,n1+n2)
    Out(1:n1)=uu1
    Out(n1+1:n1+n2)=uu2