Info

此问题已关闭。 请重新打开它进行编辑或回答。

Is it possible to use a ConnectionCallback without an External Script?

1 次查看(过去 30 天)
I would like to enable a callback function for a port connection change, in a block within a blockset I am developing for several users. But I do not want to require each of these users to maintain any m-script files in order to use these blocks. I have attempted to use an anonymous function or a function handle within the model's workspace, but I haven't found any syntax which has worked. The functionality I want for this callback would be the same as the block's CopyFcn callback, so the function could be something as simple as:
@(x) eval(get_param(get_param(x,'Parent'),'CopyFcn'))
'x' would be the connection port's handle, its 'Parent' would be the block, and so this line would evaluate the block's copy function. But how do I get the port's ConnectionCallback to execute this line without using an external script?

回答(0 个)

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by