フィルターのクリア

APP DESIGNER 2016a: Sending variables into an App from a script/function

2 ビュー (過去 30 日間)
Akash G
Akash G 2016 年 9 月 26 日
回答済み: Melissa Williams 2016 年 10 月 14 日
Hello,
I'm working from a non-app function that is constantly collecting data through the serial port. I want MATLAB to take some of this data and display it using the gauges in App Designer while it is updating in real-time.
Is this possible? Would I want to (1) call the App from an outside function where the serial data is being collected or (2) do I want to do all of the serial collection in the App?
I don't have any experience using the App designer at all, would someone be able to point me toward some example code? I can't find any outside of this Answers forum.
Cheers, Akash

採用された回答

Sean de Wolski
Sean de Wolski 2016 年 9 月 26 日
I would have the app call the function that collects the serial data. The serial data collection should be completely independent of the app so that you can test it and drive it without the app. The app should call this function, get whatever data it needs from it and update its own gauges.
  1 件のコメント
Akash G
Akash G 2016 年 9 月 26 日
Thank you Sean, do you know where I can find some example code for App Designer? Specifically something that updates in real-time?

サインインしてコメントする。

その他の回答 (1 件)

Melissa Williams
Melissa Williams 2016 年 10 月 14 日
Akash,
I can't say for sure this will work for your use case, but a simple example of a function that launches an app and then updates the value of the gauge, to get you started:
  • Create an app in App Designer, add a gauge, name it MyGauge, and set its maximum to be 60. Save it as app1.
  • Create a function like below:
function updateGauge
% Launch the app and keep a handle to it
myApp = app1;
for i = 1:60
%Update the value on the gauge
myApp.MyGauge.Value = i;
pause(1)
end
end

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by