Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
If Statements w/ To Workspace Blocks Help Please!

Subject: If Statements w/ To Workspace Blocks Help Please!

From: Eric

Date: 5 Jul, 2012 21:59:08

Message: 1 of 4

hey everybody,

I'm currently using an if statement for 2 cases:
1. time = 0
2. time > 0

For each case I'm modifying a variable A (differently in each case).
The problem comes when I try to use the To Workspace block in both of the cases. I get the following error:

Duplicate data logging variable name simulink

Is there a way solve this problem. I want to be able to get the variable A from both time = 0 and time > 0, so that I can plot it against time. Thanks for the help in advance.

- Eric

Subject: If Statements w/ To Workspace Blocks Help Please!

From: Phil Goddard

Date: 9 Jul, 2012 23:53:31

Message: 2 of 4

How is the variable A propagated through the model?

Assuming it's a signal then put the To Workspace block after the t=0 and t>0 values have been merged.

Phil.

Subject: If Statements w/ To Workspace Blocks Help Please!

From: Eric

Date: 10 Jul, 2012 15:05:27

Message: 3 of 4

"Phil Goddard" <phil@goddardconsulting.ca> wrote in message <jtfqtr$k1c$1@newscl01ah.mathworks.com>...
> How is the variable A propagated through the model?
>
> Assuming it's a signal then put the To Workspace block after the t=0 and t>0 values have been merged.
>
> Phil.

Thanks Phil for the help!

Subject: If Statements w/ To Workspace Blocks Help Please!

From: Eric

Date: 10 Jul, 2012 15:56:12

Message: 4 of 4

"Eric " <etgonehomie22@gmail.com> wrote in message <jthgbn$sp5$1@newscl01ah.mathworks.com>...
> "Phil Goddard" <phil@goddardconsulting.ca> wrote in message <jtfqtr$k1c$1@newscl01ah.mathworks.com>...
> > How is the variable A propagated through the model?
> >
> > Assuming it's a signal then put the To Workspace block after the t=0 and t>0 values have been merged.
> >
> > Phil.
>
> Thanks Phil for the help!

I just tried this and it actually didn't work. I forgot to mention that the variable is a read/write data block. This is because the variable A gets modified and used throughout the simulation. When I used the write data A on both the if and else statements, and then merged it at the end, the read data A block wasn't reading properly. Sorry if this is confusing, but if possible, would anybody be willing to look at my simulink model? Thanks again in advance!

- Eric

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us