How to store variable name AND value in an array?

조회 수: 9 (최근 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 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