Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Variable threshold switch simulink

1,325 views
Skip to first unread message

Stratox

unread,
Jan 22, 2008, 10:09:18 AM1/22/08
to
Hello,
i would insert a variable instead of a numerical value in the threshold
field of a standard switch.
The issue is that the variable is not defined in the workspace but is
generated from a simulink block.
I've already tried the block "to workspace" but it returns the array
just at the end of the simulation, but I need these values in real time
during the simulation...
Any suggestion?
Thanks in advance

Alessio

Praetorian

unread,
Jan 22, 2008, 11:11:32 AM1/22/08
to

Implement the switch condition externally, using Logical / Relational
Operator blocks for instance, and pass a boolean to the switch. The
switch mask can then be set to ~=0.

HTH,
Ashish.

Fangjun Jiang

unread,
Jan 22, 2008, 11:16:02 AM1/22/08
to
You could use the Relational Operator to compare the two
variables and then use its output to drive a Switch block.


Stratox <str...@invalid.inv> wrote in message <47960725$0
$37194$4faf...@reader3.news.tin.it>...

Stratox

unread,
Jan 22, 2008, 11:20:05 AM1/22/08
to
Praetorian wrote:
> Implement the switch condition externally, using Logical / Relational
> Operator blocks for instance, and pass a boolean to the switch. The
> switch mask can then be set to ~=0.

Thanks for the answer, it seems to be the only solution!

Umair Soori

unread,
Feb 2, 2008, 9:20:03 AM2/2/08
to
Hi there,

I have similar problem as u give answer in matlab central


guess you can use sim('model').

First, in your Simulink model, you need to set up the
configuration parameters. Check the input [t u], output
yout and set proper solver and simulation time.

Then, in your m-script, you need to set up value for [t u]
as the input to your simulation model. call sim('model')
you'll get yout in the workspace. That's the output of
your Simulink model.

"Meghan McGookin" <m.mcgook...@gla.ac.uk> wrote in
message <fjjmik$ppc$1...@fred.mathworks.com>...
> I have a complex mathematical model in Simulink block (2
> inputs and 7 outputs). Currently, I am writing a program
to
> control the mathematical model in Matlab script (m-file).
> How can I 'convert' or call for the Simulink block from
> within the m-file? The model will be running in a 'for'
> loop, hence using the input or output workspace is not
> practical.
>
My problem is I hv a complex simulink program and i have to
use my simulink model output in my M-file program, how can
I use yout in my m-file??? bcoz yout is not coming in
workspace...i also try
v = evalin('base', 'yout'); but yout is not in
workspace, same problem

do u have any idea plz help me

Kind Regards

Dev Shah

unread,
May 7, 2023, 8:14:14 PM5/7/23
to
thanks praetorian. didnt know abou the output data type
0 new messages