The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Stream data form MATLAB to Simulink
Replies: 7   Last Post: Nov 24, 2016 9:20 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Jerry Gregoire

Posts: 8
Registered: 1/24/12
Re: Stream data form MATLAB to Simulink
Posted: Jan 30, 2013 1:51 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Michal" wrote in message <ka5id3$hle$>...
> You still don't get a point... :/ Ok, then, I'll try to show you something:
> 1. Build a model in Simulink, just as you wanted me to build, and in addition connect a Scope to the output of Constant. Put an 'a' inside a Constant as parameter, and set inf for a time simulation.
> 2. Create a m-file with a simple code just like this one:
> tic
> for i= 1:1000
> a=int2str(i)
> set_param('model1/Constant','Value',a);
> end
> toc
> 3. Set an a for a initial value a=0;
> 4. Start A Simulink model.
> 5. Start a m-file script
> 6. Wait for a script to reach it's end (takes approximately 1.4 sec. on dual core 2 ;) )
> 7. Stop a Simulink model
> 8. Open a Scope...
> And then you will finally know that the problem is... You see know? If still don't I'll explain one more time: For the beginning the model1 was running with a=0 and displaying that value... Then when you've started a m-file script it pauses... waits until it ends and continue to run with the LAST value of parameter a, which is in that case 1000. I can record a movie if it's still not enough clear what the problem is. ;)

The above sarcasm is unfortunate but the issue is real. I find the following:
1) If I run the code suggested:
for i= 1:10
% pause(eps); % A pause is necessary for a running model of Simulink to update

Simulink model is Constant ---> scope, sample time set to 1ms.

while Simulink is running (to inf), The constant block on the Simulink GUI is not updated unless I pause the mcode. This is typical with ML, (e.g.) plots.

If I put the pause in the mcode while concurrently running the model (0 inf), then things really slow down. 15 - 30 sec for a = 1:10 with pause/update compared to 7ms without. With the pause the scope shows staircase as expected, but it is very uneven, (not expected).

Unfortunately, without the pause the scope only seems to update at the end resulting in a flat trace at 10.

Any understanding of what/how ML and SL are interacting would be helpful. I have seen timing get all messed up if I had concurrent ML timers running. See Is this the issue with ML and SL? I know Real time behavior can not be expected with ML, but approximate Real Time would be nice. It seems to just fall flat on its face in this area.


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.