how do I create Matraix with same elements for several rows

I have No of turbines = [25,35,45,55,65];
I want No_of_turbines=25 35 45 55 65
25 35 45 55 65
25 35 45 55 65
'' '' '' '' ''
and so on...
In essence, I have to copy the row vector several times into columns...please help
Thanks in advance

 채택된 답변

Stephan
Stephan 2019년 10월 21일
편집: Stephan 2019년 10월 21일
turbines = [25,35,45,55,65];
how_often = 10;
No_of_turbines = repmat(turbines,how_often,1)
to get it ten times:
No_of_turbines =
25 35 45 55 65
25 35 45 55 65
25 35 45 55 65
25 35 45 55 65
25 35 45 55 65
25 35 45 55 65
25 35 45 55 65
25 35 45 55 65
25 35 45 55 65
25 35 45 55 65

댓글 수: 2

Hey, I have one more quick question..
I have a array C=8760X1;
I want to make a array matrix of C=[C,C,C,C,C];
Can you help me with something other than hard coding like I mentioned above...?
Thanks in advance
Here it is with random values - just take the second argument of repmat:
C = rand(8760,1);
how_often = 5;
C_new = repmat(C,1,how_often)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Wind Power에 대해 자세히 알아보기

태그

질문:

2019년 10월 21일

댓글:

2019년 10월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by