Filter löschen
Filter löschen

How to show function's result from command window to a "text area or edit field" in app designer ??

5 Ansichten (letzte 30 Tage)
I am creating an application and for that I have developed .m file for my project. This .m file is developed with OOP for keysight signal Analyzer which is working perfectly fine.
Now, I can call my functions from/in the application, but I could now show my results in the text area or edit field in the applicaiton.
Here you can have a bit more idea about it, please take a look. :-
This piece of code is from my .m file:
%! Get the Power of the Marker-1
function Power = get_power(obj, id)
command0 = sprintf(':CALCulate:MARKer%d:Y?', id);
Power = query(obj.interface, command0);
end
And this is the result from Command Window for the given function:
>> obj.get_power(1)
ans =
'-4.83452345E+01'
In App Designer this is what I have tried
% Button pushed function: getMarker'sPowerButton
function get_powerButtonPushed(app, event)
app.obj.get_power(1); % calling function from .m file
end
% Value changed function: PowerTextArea
function TextAreaValueChanged(app, event)
%???????????????????????
end
I have tried many diff. ways to solve it but did'n work out :(
Here is a picture from my design view for proper understanding.
Please help me to show this result(ans) into a text area or edit field.

Akzeptierte Antwort

Voss
Voss am 29 Nov. 2022
Bearbeitet: Voss am 29 Nov. 2022
function get_powerButtonPushed(app, event)
app.PowerTextArea.Value = app.obj.get_power(1);
end
Note that this is the callback function of the pushbutton; the textarea doesn't need a callback function for this.

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by