フィルターのクリア

how do I create Matraix with same elements for several rows

1 回表示 (過去 30 日間)
venkat siddhartha rama
venkat siddhartha rama 2019 年 10 月 21 日
コメント済み: Stephan 2019 年 10 月 21 日
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 件のコメント
venkat siddhartha rama
venkat siddhartha rama 2019 年 10 月 21 日
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
Stephan
Stephan 2019 年 10 月 21 日
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 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by