How to create a Looped Colum Matrix?

9 views (last 30 days)
Hi, I want to create a column matrix that contains numbers from 0 to 1 (in intervals of 1/1440) 365 times. For example ( create a matrix from 1 to 3, 2 times) would be: A = [1;2;3;1;2;3]. Thank you!

Accepted Answer

Stephen23
Stephen23 on 27 Feb 2018
Edited: Stephen23 on 27 Feb 2018
V = linspace(0,1,1441);
V = repmat(V(:),365,1);
The simpler example:
V = [1;2;3];
V = repmat(V(:),2,1);

More Answers (1)

David Fletcher
David Fletcher on 27 Feb 2018
Edited: David Fletcher on 27 Feb 2018
a=linspace(0,1,1440)
a=repmat(a,365,1)
  1 Comment
Stephen23
Stephen23 on 27 Feb 2018
Edited: Stephen23 on 27 Feb 2018
This gives incorrect spacing of the values, and will return a matrix, not the requested column vector.

Sign in to comment.

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!