I have a parameter in my simulink mask: refName
. In the Mask Initialization tab, I first initialize it as a 1 x 300 vector of type double
. I have to do this because this vector is further propagated to a C++ S-Function, where the arrays cannot (easily) be of variable sizes.
After this, in the same initialization tab, it is assigned a value based on the user's input of another parameter refType
. So, for example, if refType is 'R32', refName might be [1 2 3] (not all 300 cells are used), if refType is R410A, refName might be [4 5 6] and so on.
The problem I am having is in trying to send this variable to the workspace (as a variable refNameU
) before simulation starts. I tried setting refNameU = get_param(gcb,'refName')
in the CloseFcn, InitFcn and LoadFcn block callbacks, but for some reason, the value in the workspace is always zero regardless of which callback it gets called from. And not a vector of size 300 with all zeros, but just zero.
For reference, I have the 'Evaluate', 'Enable Parameter' and 'Tunable' options for the refName parameter all checked. Could someone explain to me what I am doing wrong and how I can solve this problem? Thanks in advance.
mxGetNumberOfDimensions
,mxGetM
,mxGetN
etc. – Praetorian