save variables from GUI to workspace (variables not accesible )

조회 수: 22 (최근 30일)
maximilian comploj
maximilian comploj 2015년 2월 7일
댓글: Arshavin Hasegava 2020년 7월 17일
hello I created a GUI with GUIDE and values are entered by the GUI Variables are then saved seperately in a text file all perfect. BUT I cannot acces to the variables in the WORKSPACE.
I would like to make my variables visible and so that i can acces to them for further projects.
Can someone HELP please thank u a lot.

답변 (1개)

Jason Moore
Jason Moore 2015년 2월 7일
Which ever variables you would like to be in the workspace simply save them off to the base workspace by doing
myVar = 5
assignin('base','myVar',myVar)
in this case assignin takes three arguments. First, the workspace to save the variable. Second, the name of the variable. Lastly, the value of the variable.
  댓글 수: 3
Walter Roberson
Walter Roberson 2015년 6월 19일
편집: Walter Roberson 2015년 6월 19일
uicontrol callbacks cannot return a value. See though
Note:
assignin('base', 'myvar', file_path)
would be valid when file_path is a string.
Arshavin Hasegava
Arshavin Hasegava 2020년 7월 17일
the best way is to use " assignin"
assignin('base', 'x', x);

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

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by