# MATLAB: Dynamic vectors into cell

cellsMATLABvectors

Hi!
I have 3 vectors (here A,B and C) that could have diferent size (are dynamics, size is not define) and i need to make a cell like "MyCorrectData" where the last column ist logical.
``A=[1 1 1]B=[2 2 2]C=logical([1 0 1])MyCorrectData={1 2 true; 1 2 false; 1 2 true}; %this is what i want``
This works almost fine, but the last column lost the type and convert in double
``A=[1 1 1]B=[2 2 2]C=logical([1 0 1])MyCorrectData={1 2 true; 1 2 false; 1 2 true}; %this is what i wantMyData=[A B C]MyData=num2cell(MyData)``
How can i solve this?
Thanks!

``>> D = [num2cell(A(:)),num2cell(B(:)),num2cell(C(:))]D =     [1]    [2]    [1]    [1]    [2]    [0]    [1]    [2]    [1]``
``>> MyCorrectData={1 2 true; 1 2 false; 1 2 true}; %this is what i want>> isequal(D,MyCorrectData)ans =     1``
``>> D = {A,B,C}; % any number of suitably-sized arrays.>> D = cellfun(@(a)num2cell(a(:)),D,'uni',0);>> D = [D{:}] % horzcatD =     [1]    [2]    [1]    [1]    [2]    [0]    [1]    [2]    [1]``