Effacer les filtres
Effacer les filtres

Adding a value to a vector

2 vues (au cours des 30 derniers jours)
Chau Chin Haw
Chau Chin Haw le 16 Jan 2021
Commenté : Jan le 16 Jan 2021
I have vector x
x=[ 1 2 3 ]
I want i add value 4 to every value in x
[ 1 2 3 ] + 4
Expected outcome
x=[ 5 6 7 ]
How can i perform this in matlab?
  1 commentaire
Jan
Jan le 16 Jan 2021
Did you try this? [ 1 2 3 ] + 4 is working already.

Connectez-vous pour commenter.

Réponses (1)

Cris LaPierre
Cris LaPierre le 16 Jan 2021
The same way. What have you tried?
See Ch 6 of MATLAB Onramp.
x=[ 1 2 3 ];
x=x + 4
x = 1×3
5 6 7

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by