How to run my_func() simultaneously for multi user commincation
3 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Walter Roberson
on 24 Dec 2015
You should probably look at the Parallel Computing Toolbox, with spmd() or parfor() or parfeval()
2 Comments
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?
See Also
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!