Effacer les filtres
Effacer les filtres

Multiplying two variables in a table together

2 vues (au cours des 30 derniers jours)
AluminiumMan
AluminiumMan le 5 Mar 2024
Commenté : Voss le 5 Mar 2024
How would you multiply two variables/columns together from a table together, to create a new variable/column?
Lets say for example you have the following table:
Time Voltage Current
_____ _____ _____
1 8 2
2 9 4
3 6 6
And you want to multiply voltage and current together at each sample.
So you'd end up with a 4th column/variable called power that is voltage multiplied by current at each time interval

Réponse acceptée

Voss
Voss le 5 Mar 2024
T.Power = T.Voltage.*T.Current;
where T is your table.
  3 commentaires
AluminiumMan
AluminiumMan le 5 Mar 2024
This worked. Thank you
Voss
Voss le 5 Mar 2024
You're welcome!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by