Thread Subject: Parallel M-File S-Function

Subject: Parallel M-File S-Function

From: Francesco

Date: 17 Nov, 2009 12:09:02

Message: 1 of 2

Hi,
I would like to know if a Level 2 M-File S-Function can include parfor loops in its code or, as is my understanding, in Simulink you can only run parallel simulations of the same model.

Many thanks in advance,

francesco

Subject: Parallel M-File S-Function

From: Edric M Ellis

Date: 25 Nov, 2009 08:41:24

Message: 2 of 2

"Francesco " <francesco.trasino@rrfcs.com> writes:

> I would like to know if a Level 2 M-File S-Function can include parfor loops
> in its code or, as is my understanding, in Simulink you can only run parallel
> simulations of the same model.

I don't know of any specific restrictions here, and got things working with an
outputs function like this:

%%%
function Outputs(block)
    total = 0;
    parfor ii=1:floor(block.InputPort(1).Data)
        total = total + ii;
    end
    block.OutputPort(1).Data = total;
end
%%%

(Of course, this is a very inefficient PARFOR loop!)

Cheers,

Edric.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
parallel computing Francesco 17 Nov, 2009 07:14:02
simulink Francesco 17 Nov, 2009 07:14:02
m sfunction Francesco 17 Nov, 2009 07:14:02
rssFeed for this Thread

Contact us at files@mathworks.com