evalin data dictionary design data unable to use parameters on rhs of expression
2 views (last 30 days)
Adam Jaslikowski on 25 Aug 2020
I'm trying to write a MATLAB script that can perform pre-processing computations on a data dictionary prior to Simulink running. I've been trying to write a script that is called from the 'evalin' interface with the Dictionary design data section as the first input and my script as the second:
Assume the dictionary already has parameters x and y with some arbitry values
if my_script.m has:
There's no problem. If I modify my_script.m to:
There is an error when calling evalin:
"Could not evaluate 'my_script' in data dictionary
After further testing, it doesn't seem like I can use an existing parameter anywhere on the rhs of an equation. Is this correct?
Mohith Kulkarni on 28 Aug 2020
The "evalin" function for data dictionary section does not support the expressions where the value contains data entries as of now. But I have brought this issue to the concerned people and it might be considered in any future release.
More Answers (1)
stozaki on 28 Aug 2020
Edited: stozaki on 28 Aug 2020
The "evalin" function for data dictionary section does not support the expressions.
The workaround can be replaced by the following formula.
For example, how about preparing a wrapper function like the following?
function [Object] = evalinCustomWrap (modelName,varStr)
modelVar = verLessThan('Simulink','8.5');
% If the target model is using a MATLAB release supported by .sldd
Object = Simulink.data.evalinGlobal(modelName,varStr);
Object = ;
% If the target is using a MATLAB release that does not support sldd
% Only evalin can be used
Object = evalin('base',varStr);
Object = ;