How to run my_func() simultaneously for multi user commincation

3 vues (au cours des 30 derniers jours)
karthiksankar
karthiksankar le 24 Déc 2015
Commenté : Walter Roberson le 25 Déc 2015
function my_func(arg1,arg2)
% some process
end
How to run above function Simultaneously for multi user purpose?
Is it possible in matlab?
Thanks in Advance

Réponses (1)

Walter Roberson
Walter Roberson le 24 Déc 2015
You should probably look at the Parallel Computing Toolbox, with spmd() or parfor() or parfeval()
  2 commentaires
karthiksankar
karthiksankar le 25 Déc 2015
Modifié(e) : Walter Roberson le 25 Déc 2015
spmd(),parfor(), parfeval() these functions are use single program run with multiple data but i need single function run many times matlab on the same machine. Its like multi threading.
Walter Roberson
Walter Roberson le 25 Déc 2015
spmd can test its lab number to determine which routine to execute. You can pass an array of function handles to parfor and choose which to execute based upon the the index variable. You can execute arbitrary functions with parfeval() -- no two of them need to be the same call if you do not want to. In other words, none of them are restricted to use a single program on multiple data.
spmd can use labsend() and labreceive() to communicate between labs. parfor and parfeval() can use tcp or udp to communicate.
If you really want to have different MATLAB sessions, you can invoke the MATLAB executable with a -r option that provides the session with a command to execute. This might not be as efficient as some of the other possibilities.
What are you trying to do, something like a multiplayer game or instant messaging application?

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB Compiler 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