I want to run two while functions at the same time , for example make two cores of my computer work on loop 1 and two cores on loop 2 .
Is it possible in matlab ?

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 17 Jan. 2019

0 Stimmen

If you have the Parallel Computing Toolbox, you can use
parpool(2)
parfevalOnAll(@maxNumCompThreads, 0, 2)
spmd
if labindex == 1
first_function
else
second_function
end
end

Weitere Antworten (1)

nanren888
nanren888 am 17 Jan. 2019

0 Stimmen

Sure, run two Matlabs.
Why?

1 Kommentar

John Carlson
John Carlson am 20 Jan. 2019
It's not possible for some problems.
For example if you are connecting with a raspberry pi you can only publish one connection through one matlab .

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Parallel Computing Toolbox finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by