Masked Subsystem: How to pass a double vector to a constant?
5 views (last 30 days)
This is a slightly long-winded problem, but should be easy to follow along.
End goal : Input a 'double' vector into a C++ S Function by assigning it to a Constant.
Starting point: A function within the Dialog Callback of my masked subsystem returns the double vector that I need.
Steps in the middle: So I have a double vector as an input, I need a double vector as an output, but I cannot pass the vector directly, because set_param requires that I pass the value as a string.
Problem: What I tried is this:
- gcb (correctly) returns the block from within which I am doing everything.
- refNameArray is the parameter which needs to be assigned the double vector
- refName is the vector, in 'double' form, that I have available within the dialog callback of the mask.
I use num2str because I cannot directly assign a vector, I must input it as a string. But, even using num2str, I get an error saying
Invalid Setting in Block <blockName> for parameter 'Value'.
Yao Li on 28 Jan 2014
I'm not quite sure about your issue. In general, if you want to assign a value to a parameter in a masked subsystem, add it as a parameter in the Mask Editor as shown in the following link
and then assign the value by
In case you do need to convert the value to a string first, try converting the array to a cell and converting it back to a double type array by the command sprintf()