I want to repeat every element of a column array (10rows,1column) four times, and put all together in one column array.. please suggest any method

eg: t(10,1)=[1;2;3;4;5;6;7;8;9;10] and i want result=[1;1;1;1;2;2;2;2;3;3;3;3;4;4;4;4;5;5;5;5;6;6;6;6;7;7;7;7;8;8;8;8;9;9;9;9;10;10;10;10]
please any body suggest the way out thank you

Answers (4)

repelem(t, 4)

4 Comments

sorry Mr Alexandera, its not working, showing error as ??? Undefined function or method 'repelem' for input arguments of type 'double'.
Without needing to define t the way you mention in the original answer, you can write it like this:
t = (1:10)';
repelem(t, 4)
What MATLAB version are you using?
(Btw it's 'Miss'. Not 'Mr'.)
my matlab version isR2009a may be that may be the reason
repelem was introduced in R2015a. It is a good idea to mention which matlab version you're using in the question particularly when it's that out of date.

Sign in to comment.

thank you i got the answer

1 Comment

Then select the answer, which solves your problem or post an own answer for selecting, such that the forum can see, that the problem ist solved. Thanks.

Sign in to comment.

Asked:

on 2 Dec 2016

Commented:

Jan
on 5 Dec 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!