Why am I getting the error "Invalid parameter" when trying to use setparam to modify the structure parameter in target?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 13 Nov. 2017
Beantwortet: MathWorks Support Team
am 5 Feb. 2018
I have a structure 's' created in Model workspace and being used as a block parameter. Now in "setparam" command, how can I programmatically update the value of specific fields inside this structure? The goal is to update the structure “values only” and having the target reflect these modifications without having to rebuild and deploy the model again.
If I use the structure information shown in slrt explorer in "setparam", I am getting the following error:
>> setparam(tg,'blkName','/s(1).one',2)
Invalid parameter: "blkName//s(1).one"
Where, '/s(1).one' is the value of the field "Properties -> BindingSrcPath" in slrtexplr for the corresponding structure parameter.
Akzeptierte Antwort
MathWorks Support Team
am 13 Nov. 2017
Since the structure is created as an object in Model workspace, it is a global structure parameter and to access the global structure parameters in "setparam", you should use the complete field name as follows. There is no block information necessary to use global parameters in "setparam".
>> setparam(tg,'s(1).one',2)
or
>> setparam(tg,'s.one',2)
Where "one" is the field name inside the structure "s1"
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Structures finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!