creating variable of specified length and same values

6 次查看(过去 30 天)
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

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by