Effacer les filtres
Effacer les filtres

make two while loop work parallely

2 vues (au cours des 30 derniers jours)
John Carlson
John Carlson le 17 Jan 2019
Commenté : John Carlson le 20 Jan 2019
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 ?

Réponse acceptée

Walter Roberson
Walter Roberson le 17 Jan 2019
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
  1 commentaire
John Carlson
John Carlson le 20 Jan 2019
Thanks a lot , it worked just fine.

Connectez-vous pour commenter.

Plus de réponses (1)

nanren888
nanren888 le 17 Jan 2019
Sure, run two Matlabs.
Why?
  1 commentaire
John Carlson
John Carlson le 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 .

Connectez-vous pour commenter.

Catégories

En savoir plus sur Parallel Computing Fundamentals dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by