How to I convert MATLAB code written for EV3 Brick into MATLAB function block for Simulink?
5 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
jeff matejka
2019-2-16
编辑:jeff matejka
2019-2-17
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 LEGO MINDSTORMS EV3 Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!