Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

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

1 visualizzazione (ultimi 30 giorni)
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?

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by