creating variable of specified length and same values

6 visualizzazioni (ultimi 30 giorni)
Hi,
How could I create a 4x1 variable of the value 1.2?
For example
1.2
1.2
1.2
1.2

Risposta accettata

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

Più risposte (2)

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

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

Categorie

Scopri di più su Get Started with MATLAB in Help Center e File Exchange

Tag

Non è stata ancora inserito alcun tag.

Community Treasure Hunt

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

Start Hunting!

Translated by