MATLAB Answers

How to save a m-file on the lego ev3 brick?

5 views (last 30 days)
Philipp Rau
Philipp Rau on 13 Nov 2015
Commented: Walter Roberson on 19 Nov 2015
Hello, I need to know how i can save an matlab m-file on a lego ev3 brick using an usb-connection. I didn't found anything on google. I would like to select the saved program on the brick and run it with the buttons. But how to get it there? At the moment i am just able to run the programm while the brick ist connected with the usb-cable. please help me :) Thanks


Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 13 Nov 2015
You could possibly transfer the source to the ev3, but none of that series can execute MATLAB m files. The process of using an ev3 involves generating code that the ev3 can use, and that code is not m files at all.


Philipp Rau
Philipp Rau on 13 Nov 2015
so then please tell me HOW can i program in matlab (not simulink) and then transfer to the ev3? I havn't even a clue how to access the ev3 for saving a file. I just can run my m-file while connected, and thats really not useful.
Walter Roberson
Walter Roberson on 19 Nov 2015
Looking around a bit, it appears that you can ssh to the ev3. It appears to require the username root and the password is empty (not the word "empty", just press return at the password prompt). If this is the case then you can also scp() files on to the EV3 and then ssh in and start them executing.
The EV3 can be programmed in a number of different programming languages. I do not know which one Simulink uses, but it probably uses C or C++ together with a cross-compiler for the ARM processor.
If you want to convert MATLAB code into something that would run on the EV3, the simplest way would be to include it in a MATLAB Function Block in Simulink and use Simulink to generate and run the model. But otherwise you are going to need to use MATLAB Coder and a cross-compiler. MATLAB Coder is not available for Student Version licenses.
There might be some other method that I have missed.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by