How to store variable name AND value in an array?

12 ビュー (過去 30 日間)
HC98
HC98 2022 年 8 月 26 日
回答済み: 添昊 张 2022 年 8 月 26 日
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 Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by