How to store variable name AND value in an array?

12 vues (au cours des 30 derniers jours)
HC98
HC98 le 26 Août 2022
Suppose I have some code which produces the following outputs:
density = 456
pressure = 356
temperature = 66
How can I store these variables and their names in an array to save them from being printed in the terminal for example?

Réponse acceptée

Chunru
Chunru le 26 Août 2022
density = 456;
pressure = 356 ;
temperature = 66;
% or use struct
a.density = 456;
a.pressure = 356 ;
a.temperature = 66;

Plus de réponses (1)

添昊 张
添昊 张 le 26 Août 2022
use 'who' to list variables in workspace?

Catégories

En savoir plus sur Workspace Variables and MAT-Files dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by