save variables in Matlab GUI

조회 수: 2 (최근 30일)
Huda M
Huda M 2022년 3월 9일
편집: Stephen23 2022년 3월 10일
hello;
if I want to save some constant
x=100;
y= 200;
how I save them in the Matlab GUI code as seen below

답변 (1개)

Rik
Rik 2022년 3월 9일
For general advice and examples for how to create a GUI (and avoid using GUIDE), have look at this thread.
With your current setup you can store them in the guidata:
handles.x=100;
handles.y=200;
guidata(handles.figure,handles)
  댓글 수: 10
Huda M
Huda M 2022년 3월 10일
so is it impossible to do it?
Stephen23
Stephen23 2022년 3월 10일
편집: Stephen23 2022년 3월 10일
"so is it impossible to do it?"
I doubt that it would be impossible, but it is unlikely to be good data design or good code.
Accessing the property of a class or field of structure would be simpler. Or perhaps a basic array...
"if I want to save some constant"
Where? In the base workspace or in one of the GUI workspaces or somewhere else?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by