Implementing your own function in a simulink model
이전 댓글 표시
I have written a simple color filter function in MATLAB 2010a. I am trying to create a Simulink model where I can pass live video through this function so that I can see only the color blue, however I never seem to find the right block for user defined functions. I have tried the Embedded MATLAB function, but it never seems to work and I don't think it is for what I am trying to do. I have tried the function block, but that only takes a one dimensional input, video has three. The other option is s-functions, but I don't know if that is too complicated for what I am trying to do. I would appreciate it if someone could point me in the right direction.
Thanks,
Roshan
채택된 답변
추가 답변 (1개)
Guy Rouleau
2011년 3월 3일
1 개 추천
I wrote the following post especially to give tips on finding the best implementation for your for problems like yours:
Based on the description you give, I would go for a level 2 MATLAB s-function. It is not as complicated as it seems and give you all the power of MATLAB. If you plan to generate code for deployment on a real-time system, then I recommend Embedded MATLAB.
댓글 수: 2
Roshan
2011년 3월 7일
Guy Rouleau
2011년 3월 8일
"@" is to define a function handle, do a quick doc search for "function handle" to learn more on that topic. Note that you don't really need it here. Type "sfundemos" in MATLAB to open all the s-function demos. Then look in the MATLAB files ection and the Level 2. You will find many examples and the template. I recommend always starting form a demo or the template to make you blocks.
To answer "what does block.NumDialogPrms mean?", please use the doc or try your intuition... Num as in "Number", dialog as in "dialog" and "Prms" s in parameters... assemble that and you have a parameter defining the number of dialog parameters of your block ;-)
http://www.mathworks.com/help/toolbox/simulink/slref/simulink.runtimeblock.html
HTH,
Guy
카테고리
도움말 센터 및 File Exchange에서 Block and Blockset Authoring에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!