- 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?
조회 수: 14 (최근 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에서 Programmatic Model Editing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!