From: us on
"Shal" <shalini_priti(a)yahoo.co.in> wrote in message <ho06ms$76m$1(a)fred.mathworks.com>...
> Suppose I have a numeric cell, i.e.
>
> b= [1 2 3 4 5 6];
> B= num2cell(b);
>
> B=
> [1] [2] [3] [4] [5] [6]
>
> How do I replicate the elements within cell
> I want something like this:
>
> C=
> [2x2 double] [2x2 double] [2x2 double] [2x2 double] [2x2 double] [2x2 double]
>
> where on expansion, the values within cell B is
>
> C=
> [1 1 [2 2
> 1 1] 2 2] ........
>
> If I use repmat, C= repmat(B,2,2), it replicates the whole cell and not the elements within cell
> --
> Thanks
> Shal

one of the solutions

c=num2cell(1:4);
cr=cellfun(@(x) repmat(x,2,2),c,'uni',false);
cr{1}
%{
% ans =
1 1
1 1
%}

us