Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to invoke a level 2-s function's callback method from an external .m file?

조회 수: 2 (최근 30일)
Shantanu
Shantanu 2013년 7월 8일
마감: MATLAB Answer Bot 2021년 8월 20일
Is there any way, I can assign values for a callback method of a Level 2-s function block?
For instance, I have a custom made simulink Level 2-s function block, "Block1.m". This block has (obviously) an "Outputs(block)" function.
Now, I want to assign some values to the parameters of the block using an external .m file, e.g. "external.m". So "external.m" supposed to have something like,
Block1.OutputPort(1).Data = val1;
Block1.OutputPort(2).Data = val2;
Please let me know

답변 (1개)

Kaustubha Govind
Kaustubha Govind 2013년 7월 8일
Why not call external.m and assign the outputs to local variables, and then assign those to the outputs:
[val1, val2] = external();
Block1.OutputPort(1).Data = val1;
Block1.OutputPort(2).Data = val2;

이 질문은 마감되었습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by