Using the "display()" command from a "Matlab Function Block" in simulink?

조회 수: 6 (최근 30일)
khurram
khurram 2014년 9월 8일
편집: A Jenkins 2014년 9월 8일
i am trying to use the "display()" command in simulink by simply creating a "Matlab function block" and just writing the display command in it.
i get the following error :
"Undefined function or variable 'display'.
Function 'Bit Generation/MATLAB Function' (#182.47.57), line 3, column 1: "display(u)" "
i understand that not all matlab functions can be called from the Matlab function block. kindly tell me how to do what i am trying to do regards khurram

답변 (1개)

A Jenkins
A Jenkins 2014년 9월 8일
Use disp() instead.
  댓글 수: 4
khurram
khurram 2014년 9월 8일
i am using the 2013a version. i declared it as eml.extrinsic('disp'). turns out that i had not linked a compiler to matlab. now i am installing microsoft SDK 7 for that. i hope it will run after that.
i am just wondering that is there any way to run functions in matlab itself? i mean that instead of using a c compiler is it possible that i write a m-file using matlab and my own functions and then use it in simulink by running the file in the matlab environment itself without linking it to a C compiler or anything like that
A Jenkins
A Jenkins 2014년 9월 8일
편집: A Jenkins 2014년 9월 8일
It depends on when you want the code to run and how you plan to trigger it.
Go to "File->Model Properties" and select Callbacks and you will see different model actions that can trigger code to run. For example, put m-code in the "StartFcn" and it will run once at the start.
You can also try using the Interpreted MATLAB Function block, or just the plain Fcn block.
There are other ways to trigger by setting up events and listeners, but they are significantly more effort.

댓글을 달려면 로그인하십시오.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by