Passing data between UIFigures

Hi. I'm building a program by app designer that has 3 different window. My quesiton is, how I can share data and variables between them?

댓글 수: 1

Adam
Adam 2017년 11월 21일
Since AppDesigner is based on classes it is very easy to just set data from one in another, but you haven't given any details of how you create your windows so a generic answer is far too vague and time-consuming.

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

답변 (2개)

Adam
Adam 2017년 11월 22일

1 개 추천

app2.R = R;
would work if you just want R, you don't need app1, but equally:
app2.field3 = app.field3;
for example would also work, though you should name properties as descriptively as possible.
Obviously whatever you choose you must define the property in app2.

댓글 수: 4

Muslim Danesh
Muslim Danesh 2017년 11월 25일
Thank you Sir
Fei Gao
Fei Gao 2019년 1월 22일
How can I change the class name of the second UIFigure? The names of the second UIFigure and *.mlapp can be renamed, e.g. 'app2', but the class name is also 'app', the same as the first one, and can not be changed. All properties in the second UIFigure are alsso called as 'app.*', e.g. 'app.R'.
Within a given UI class in App Designer the object itself is usually referred to as app, but in a your own function you can call it whatever you want and when you create your two GUIs you will give them each your own name that is used external to the object.
e.g.
myApp1 = App1( );
myOtherApp = App2( );
myApp1.someProperty = someValue;
myOtherApp.someOtherProperty = someOtherValue;
Fei Gao
Fei Gao 2019년 1월 22일
Thank you! I got it.

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

Muslim Danesh
Muslim Danesh 2017년 11월 21일

0 개 추천

Let say that in first class (app1), I have a piece of code for Run button callback:
function RunButtonPushed(app, event)
V = app.field1.Value;
p = app.field2.Value;
R = V*p;
app.field3.Value = R;
%open the second window
app2;
end
Then in second class (app2), after pressing the Solve button, I'm going to the value of R (from the first window). Now what is the content to be used for retrieving it from app1 classdef.

카테고리

도움말 센터File Exchange에서 Data Type Identification에 대해 자세히 알아보기

질문:

2017년 11월 21일

댓글:

2020년 7월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by