필터 지우기
필터 지우기

App Designer and Simulink Interchange

조회 수: 22 (최근 30일)
Min
Min 2024년 7월 2일 16:13
댓글: Min 2024년 7월 8일 11:51
Hi, i know it sounds a bit crazy but I want to interact between app designer and simulink.
I am working with Arduino Due, and I reahced where too many blocks in Simulink is causing some issue.
Now my approach is to read the CAN via Simulink and read that live CAN message then manipulate it within App designer.
Also, use App designer to manipulate the Arduino's I/Os.
The problem I am having is once the Simulink is connected to Arduino, I do not see any options that I can work with the Arduino's I/Os. Unless I have the Arduino blocks within the simlink that has constant block to it which can be manipulate within app designer. However, this case will not reduece the Simulink information that embedded to the Arduino.
Any ideas where I can reduce the Simulink and somehow work with Arduino at the same time?
I tried to read the CAN message via app designer, it crashed (this would be the ideal option but some reason it isn't working for me :(
Thanks!
  댓글 수: 1
Prasanth Sunkara
Prasanth Sunkara 2024년 7월 3일 5:32
Are you using a CAN Shield on Arduino to get CAN data? Or, you are reading CAN data directly from your PC using Simulink?

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

답변 (1개)

Dinesh
Dinesh 2024년 7월 3일 5:33
Hello.
I don't think there is a direct way to interact between App Designer and Simulink. You might need to use MATLAB workspace variables to read and write off of Simulink as well as App Designer apps.
I don't think an app is required to manipulate Arduino's I/Os since you can achieve this using a MATLAB script.
You could make use of a MATLAB Function block in Simulink or simply use a MATLAB script to execute code that can manipulate Arduino's I/Os. Here's a sample function:
function ControlArduino()
a = arduino('COM4', 'Uno');
% Modify value of pin D13
writeDigitalPin(a, 'D13', 1);
pause(1);
writeDigitalPin(a, 'D13', 0);
end
Here is the documentation link for connecting to arduino: https://www.mathworks.com/help/matlab/supportpkg/connect-to-arduino-hardware.html
  댓글 수: 3
Monalisha
Monalisha 2024년 7월 5일 9:35
Hello Min,
If I understand your use case clearly then you want to get the CAN recieve data and want to use it in App Designer.
Recommended Workflow:
From Simulink you can do a Build deploy start workflow. such that the code always executes in Hardware.
Send the CAN recieve data to a serial Block or TCP/IP Block in Simulink Model.
You can try recieving the CAN Data in Serial or TCP/IP , using MATLAB apis
Then this data recieved via MATLAB apis can be used direclty by the App Designer.
Min
Min 2024년 7월 8일 11:51
Hi Monalisha,
I never knew there is an option to receive and read the data from the serial or TCP/IP Block.
I will try it out and let you know.
Thanks!

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

카테고리

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

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by