Filter löschen
Filter löschen

how to use set_param in a subsystem to change values of block same subsystem

3 Ansichten (letzte 30 Tage)
Hi
I m trying to use set_param command to change values of a block of a subsystem(without mask).
The Embedded MATLAB function that contains the set_param command and the block whose values are to be changed lie in the same subsystem.
i m not sure if it is possible but through Documentation I managed following command
eml.extrinsic('set_param');
eml.extrinsic('num2str');
set_param('basicblock/Subsystem//Switch','Threshold',num2str(t));
i also tried Simple
set_param('basicblock/Subsystem/Switch','Threshold',num2str(t));
but both above commands are giving error. i am sure i am wrong with syntax for that mechanism.
help will be appreciated.
Thanx
--Regards Piyush
  1 Kommentar
Seth Popinchalk
Seth Popinchalk am 20 Feb. 2011
I suggest rewriting this question to be: "How do I change the threshold of a Switch block dynamically?"

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Seth Popinchalk
Seth Popinchalk am 20 Feb. 2011
In order to change the threshold of a switch, I recommend setting the threshold to .5 and using a Relational Operator to compare the signal to the computed threshold. The output of the Relational Operator can then connect to the control port on the Switch.
It is always preferable to use a signal to express things that change dynamically rather than SET_PARAM to modify a parameter at every step.

sonal jaiswal
sonal jaiswal am 20 Feb. 2011
thnks for ur suggestion sir... bt i m having the same problem and i want to change the block parameters using same functionality of set_param('basicblock/Subsystem/Switch','Threshold',num2str(t)); urs suggestion r always invited..
  3 Kommentare
sonal jaiswal
sonal jaiswal am 24 Feb. 2011
i have to use the set_param command in the same systemblock in which i m writing this command...value of "t" will keep changing i m using it on Integrator block actually but my problem is same as the one in above question..
Kaustubha Govind
Kaustubha Govind am 24 Feb. 2011
You cannot change the Threshold Value for the switch during model execution (as I assume you are doing from an Embedded MATLAB block) - that is why Seth suggested setting the switch Threshold to a constant value of 0.5, and connecting the output of the Relational Operator to the Switch block, since its output is always either TRUE (1) or FALSE (0).

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Schedule Model Components finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by