How to store variable name AND value in an array?

9 次查看(过去 30 天)
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?

采纳的回答

Chunru
Chunru 2022-8-26
density = 456;
pressure = 356 ;
temperature = 66;
% or use struct
a.density = 456;
a.pressure = 356 ;
a.temperature = 66;

更多回答(1 个)

添昊 张
添昊 张 2022-8-26
use 'who' to list variables in workspace?

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by