Using workspace variables inside GUIDE

조회 수: 2 (최근 30일)
Rodrigo Orderique
Rodrigo Orderique 2017년 7월 16일
댓글: Image Analyst 2017년 7월 16일
Hello everyone.
New to MATLAB here. I'm creating a GUIDE that, by the click of a pushbutton, will generate a plot. That plot is generated via a function that uses variables located in the workspace. I'm not sure as to how I can bring the data from those variables into the GUI as well as to pass that information to the function.
Any help would be appreciated,
Thanks!

채택된 답변

Image Analyst
Image Analyst 2017년 7월 16일
I don't like that way of operating, but if you insist, use evalin():
This example extracts the value of the variable var in the MATLAB base workspace and captures the value in the local variable v:
v = evalin('base', 'var');
  댓글 수: 2
Rodrigo Orderique
Rodrigo Orderique 2017년 7월 16일
Thanks for the quick answer. How would you approach this problem? I'm new so any better way of doing things is welcome.
Image Analyst
Image Analyst 2017년 7월 16일
I have all my code in one program. I find it's easier to have everything done on one GUI that takes up the whole screen rather than having to run multiple programs and have multiple GUI windows up, or having to interact sometimes in the command window, and then getting all the various programs to communicate with each other. If the programs are so large and different from each other, then I'd just have one save it's final output in a .mat file and have the other program load that .mat file.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Variables에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by