creating variable of specified length and same values

7 vues (au cours des 30 derniers jours)
John
John le 15 Nov 2013
Réponse apportée : ES le 15 Nov 2013
Hi,
How could I create a 4x1 variable of the value 1.2?
For example
1.2
1.2
1.2
1.2

Réponse acceptée

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

Plus de réponses (2)

Azzi Abdelmalek
Azzi Abdelmalek le 15 Nov 2013
Modifié(e) : Azzi Abdelmalek le 15 Nov 2013
a=1.2;
a=a(ones(1,4))
%or
a=repmat(1.2,1,4)

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

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by