How to run my_func() simultaneously for multi user commincation

4 views (last 30 days)
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

Answers (1)

Walter Roberson
Walter Roberson on 24 Dec 2015
You should probably look at the Parallel Computing Toolbox, with spmd() or parfor() or parfeval()
  2 Comments
karthiksankar
karthiksankar on 25 Dec 2015
Edited: Walter Roberson on 25 Dec 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 on 25 Dec 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?

Sign in to comment.

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!