How can I use the data from one guide in another guide?

조회 수: 1 (최근 30일)
Joshua Ztradivari
Joshua Ztradivari 2020년 6월 19일
댓글: snr matlb 2020년 6월 19일
For example, I have the following code:
NumberOfTeeth1 = str2double(get(handles.edit1,'String'))
Diameter1 = str2double(get(handles.edit2,'String'))
I want these two variables to be reproduced in another guide, specifically in text1 and text2
How can I save these two values so they can be reproduced in another interface?
  댓글 수: 3
Rik
Rik 2020년 6월 19일
You could, but you really shouldn't.
snr matlb
snr matlb 2020년 6월 19일
Generally, I try to escape from that choice, however, the background should be more flexible about using variables from *m.files to gui. Actually, same problem is alive on the same *m.file for data flow between script and function. Even on any breakpoint, I do not see the variables outside of the functio or define all arguments to the function etc.

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

답변 (1개)

Rik
Rik 2020년 6월 19일
편집: Rik 2020년 6월 19일
You will either need to make sure the second GUI has the handle to the first GUI, or save the variable to an external place both can reach:
  • the UserData property of groot
  • a preference with getpref and setpref
  • a mat file in your current folder
For general advice and examples for how to create a GUI (and avoid using GUIDE), have look at this thread.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by