How to I convert MATLAB code written for EV3 Brick into MATLAB function block for Simulink?
Ältere Kommentare anzeigen
I have written a MATLAB Code to control the EV3 Brick (Using the MATLAB Support Package for Lego EV3). Now to run it, I need to convert it to a MATLAB Function block in Simulink. How do I convert the code into the MATLAB Function block format? I am unable to find the correct Input and Output for the MATLAB Fn block in Simulink. I am attaching my code for reference.

Thanks in Advance.
Antworten (1)
jeff matejka
am 16 Feb. 2019
Bearbeitet: jeff matejka
am 17 Feb. 2019
0 Stimmen
You wont be able to use all of that in a Matlab Function in Simulink. Make sure you have the EV3 simulink support package installed and you will need the blocks for reading the sensors and motor outputs.
After you have the sensor input and motor output blocks with correct ports, youll be able to put a Matlab function block that takes the sensor as input and motor as output.
Forbthe code you posted, youll be able to do that with some logic blocks and constants.
if you need more help, the example Lego EV3 simulink programs are helpful.
Something like this

Kategorien
Mehr zu MATLAB Support Package for LEGO MINDSTORMS EV3 Hardware finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!