Matlab code to simulink model for android

3 次查看(过去 30 天)
I have written code for lane detection in MATLAB, Now I want to bring it to a simulink model with image input from android camera. Currently the matlab code calls a lot of functions,please tell me how to convert this code to simulink block. with a working simulink model I aim to bring it to android SDK n make an android app.

采纳的回答

Walter Roberson
Walter Roberson 2017-10-5
You can put MATLAB code into an MATLAB Function Block and have your Simulink model pass appropriate signals to it, such as from an Android Camera https://www.mathworks.com/help/supportpkg/android/ref/camera.html
There are a number of restrictions on what function calls can be part of a MATLAB Function Block; see https://www.mathworks.com/help/simulink/ug/functions-supported-for-code-generation--categorical-list.html
Also, you mostly need to initialize variables with the proper size and type before you use them, and you cannot change type after the first assignment. You can make variables smaller after the first assignment, but making them larger requires special calls.
  2 个评论
Anuja Vats
Anuja Vats 2017-10-5
Thanks Walter, i understand that I an combine thE R+G+B and get the image, but I need continuous frames. In matlab we can have while ~isDone(hVideoSrc) or islogging (like in sudoku solver here . how can I do it in my function block?
Walter Roberson
Walter Roberson 2017-10-5
You are thinking of Simulink as being procedural, like you have to loop to read frames. Simulink is for model based design: all the parts of it are active at the same time (unless there are triggered subsystems or the like) and inputs (perhaps just clocks) flow in and out for each component at each time step. You would put in a camera block, and once it gets going, each timestep the block would output another image on the ports.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by