- 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!