how I can relate Qt interface with Simulink model?

조회 수: 7 (최근 30일)
anass gassi
anass gassi 2020년 5월 7일
답변: Anshuman 2024년 10월 23일
I want to create a Qt interface to visualise the outputs of a simulink model , how i will relate Qt with Simulink?
  댓글 수: 2
SAJJAD ALI
SAJJAD ALI 2024년 2월 18일
편집: SAJJAD ALI 2024년 2월 18일
Hello Mr @anass gassi! its been 4 years. Did you figure it out? pls help me. I want to make system in simulink and attach it to a QtQuick GUI :)

댓글을 달려면 로그인하십시오.

답변 (1개)

Anshuman
Anshuman 2024년 10월 23일
Hello,
To create a Qt interface for visualizing the outputs of a Simulink model, you'll need to establish a communication link between Simulink and your Qt application. Here’s a general approach to achieve this:
  • Use Simulink's capabilities to export simulation data. You can log the data to the MATLAB workspace using 'To Workspace' blocks or use 'Simulink.SimulationOutput' objects.
  • MATLAB Engine API for C++: Use this to call MATLAB functions from your C++ application. You can run the Simulink model, retrieve the output data, and process it within your Qt application.
  • MATLAB Compiler SDK: Compile your MATLAB code into a shared library that can be called from C++.
  • Save the simulation data to a file (e.g., CSV, MAT-file) and read it in your Qt application. Use Qt's file handling to read 'output_data.mat' using a library like 'matio' or convert it to a format readable by Qt. You can use sockets, pipes, or other IPC methods to send data from MATLAB to your Qt application in real-time.
  • Design your Qt interface to load and visualize the data. You can use 'Qt Charts' or 'QCustomPlot' for plotting.
Hope it helps!

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by