creating variable of specified length and same values

5 ビュー (過去 30 日間)
John
John 2013 年 11 月 15 日
回答済み: ES 2013 年 11 月 15 日
Hi,
How could I create a 4x1 variable of the value 1.2?
For example
1.2
1.2
1.2
1.2

採用された回答

Aous Younis
Aous Younis 2013 年 11 月 15 日
a=1.2*(ones(4,1))

その他の回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 15 日
編集済み: Azzi Abdelmalek 2013 年 11 月 15 日
a=1.2;
a=a(ones(1,4))
%or
a=repmat(1.2,1,4)

ES
ES 2013 年 11 月 15 日
a(1:4,1)=1.2

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by