use the same result in different callback in matlab app desinger
조회 수: 2 (최근 30일)
이전 댓글 표시
hello,
I am problem that i solved using the app desiner in two step calculation but the second calculation depend on the first one each of them in edit field numeric
so how can I callback the first numeric field value to the calculation of second nuemric field
for example
a=5
b=6
c=5
x1=a*b; % this is in the first nuemricafield.value
then in second numerical field
x2=x1^c in second nuemric field
so how can i express the x1 value of first numerica field in app desinger
Thank u
댓글 수: 0
채택된 답변
Voss
2022년 3월 24일
Let's say the first NumericEditField is called EditField1 and the second one is called EditField2, and their ValueChangedFcns are called ValueChangedFcn_EditField1 and ValueChangedFcn_EditField2, respectively.
In general, you can get or set any NumericEditField's value wherever you need to by referring to app.EditField1.Value or app.EditField2.Value (or whatever they are called in your app).
So, in this situation, in the second NumericEditField's ValueChangedFcn, you can get the value of the first NumericEditField:
function ValueChangedFcn_EditField2(app,evt)
x1 = app.EditField1.Value;
% now do whatever you need to do with x1
end
And you also might update EditField2's Value whenever EditField1's Value changes:
function ValueChangedFcn_EditField1(app,evt)
x1 = app.EditField1.Value;
c = 5;
x2 = x1^c;
% set EditField2's Value to x2:
app.EditField2.Value = x2;
end
댓글 수: 6
Voss
2022년 3월 24일
Take a look at the attached .mlapp file. In that app, when EditField1 changes, EditField2's Value is set to the fifth power of EditField1's Value; when EditField2's Value changes, nothing else changes.
Try to compare the relevant parts of your app wth this app and see if there is anything different between the two that might explain why your app doesn't seem to update when it should.
If that doesn't work, can you attach your .mlapp file (and I'll take a look at it)?
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!