- Create a Simulink Model: Make sure you have a Simulink model that generates the data you want to display in your MATLAB App.
- Simulink to MATLAB Interface: You can use MATLAB's Simulink API to interact with your Simulink model. Specifically, you can use the sim function to run simulations and extract data from Simulink.
How can I update a App designer with values from my Simulink model as it is running?
11 ビュー (過去 30 日間)
古いコメントを表示
I have Display block in simulink that can display a value, I wonder if there is anyway I could read that data from simulink and display it on Matlab App designer.
0 件のコメント
回答 (1 件)
Atharva
2023 年 9 月 12 日
Hi Sarvesh,
I understand you are trying to read the data from Simulink and display it on MATLAB App Designer in read-time.
To do this, you can use the MATLAB Simulink API and MATLAB App Designer's capabilities to create a custom interface.
Here are the general steps to achieve this:
% Simulate the Simulink model
simOut = sim('YourSimulinkModel');
% Extract data from Simulink model
simData = simOut.yourOutputSignal; % Replace 'yourOutputSignal' with the signal you want to read
3.Create a MATLAB App: Create a new MATLAB App using App Designer. You can use App Designer's UI components to create the interface for displaying the data.
4.Update App with Simulink Data: Inside your MATLAB App's code, you can update the UI components with the data obtained from Simulink. For example, if you want to display the data in a text box, you can use a Label component and update its text property.
% Update the Label component with Simulink data
app.YourLabel.Text = num2str(simData);
5.Running the App: You can run your MATLAB App and use it to display the data obtained from Simulink in real-time.
I hope this helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Simulink Environment Customization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!