From: Robert Barrie on
Ahhh thanks, sorry about that - my data is actually (read in as a) a column but I had been 'playing around' with a 2:2:20... oops - thanks for the help :)

I have been prgramming other languages for over 10 years and am now working on a fairly complex matlab app. The normal programming complexity I can handle but in these early stages its the simple matrix manipluation that I am stumbling over...

thx again,

Rob
From: Matt Fig on
In case your next question is how to do a similar thing for a matrix, see this link.


http://www.mathworks.com/matlabcentral/fileexchange/24536-expand
From: Jos (10584) on
"Robert Barrie" <askme(a)ifuwant.com> wrote in message <hlt7kp$rut$1(a)fred.mathworks.com>...
> Hi All,
>
> I have a column vector of numbers that I would like to extrapolate by "doubling up":
>
> e.g. turn
> 2
> 4
> 6
> 8
>
> into:
> 2
> 2
> 4
> 4
> 6
> 6
> 8
> 8
>
> any ideas on an easy vectorised way to do this?
>
> TIA,
>
> Rob

A = [2 4 6 8].' ;
B = kron(a,ones(2,1))

hth
Jos