creating variable of specified length and same values

6 views (last 30 days)
Hi,
How could I create a 4x1 variable of the value 1.2?
For example
1.2
1.2
1.2
1.2

Accepted Answer

Aous Younis
Aous Younis on 15 Nov 2013
a=1.2*(ones(4,1))

More Answers (2)

Azzi Abdelmalek
Azzi Abdelmalek on 15 Nov 2013
Edited: Azzi Abdelmalek on 15 Nov 2013
a=1.2;
a=a(ones(1,4))
%or
a=repmat(1.2,1,4)

ES
ES on 15 Nov 2013
a(1:4,1)=1.2

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!