surgical_tubing
surgical_tubing

Reputation: 148

Pass dialog variables to function in Simulink mask initialization

I am creating self modifying Simulink blocks using the Initialization pane of the Mask Editor. Rather than work directly in the text editor of the Initialization pane, I would like to call something like init_blk(gcb) and write my code in init_blk.m so I can debug using break points. This approach works okay, but I find myself explicitly passing an ever growing list of variables. Rather than have a function of the form init_blk(gcb,param1,param2,param3, ...) I want something along the lines of init_blk(gcb,DialogParamters). I have been able to access DialogParamters inside init_blk() using get_param but this doesn't seem to preserve datatypes. Everything is a string.

So the gist of my question is this. What do I need to enter into the Initialization commands pane in order to pass whatever workspace is active for the initialization commands to a function? Or is there a better way of handling this altogether?

Upvotes: 1

Views: 1136

Answers (1)

Phil Goddard
Phil Goddard

Reputation: 10772

You want to use

get_param(gcb,'MaskWSVariables')

Upvotes: 3

Related Questions