is multi threading possible in MATLAB

I want to do programming using multi threading approach. is it possible in MATLAB? please tell

Antworten (3)

Jan
Jan am 26 Jul. 2017
Bearbeitet: Jan am 26 Jul. 2017

4 Stimmen

Many commands, e.g. sum is multi-threaded internally already: beyond a specific data size, the work is distributed to multiple threads, which are processed in parallel.
You can control the multi-threading in C-Mex functions directly. And in Matlab the Parallel Computing Toolbox offers e.g. the parfor loop to distribute the code to several workers. See https://www.mathworks.com/products/parallel-computing.html.
Note that the Parallel Computing Toolbox can distribute the work load not only to the cores of one CPU, but to multiple CPUs also, this means to different computers. See e.g. https://de.mathworks.com/help/distcomp/spmd.html. Multi-threading and parallel computing are different stories.

8 Kommentare

Sairah
Sairah am 27 Jul. 2017
hi jan simson so you mean multi threading is possibile? Actually I am new to this approach. thats why I am afraid that Matlab platform offers me to work on this or should I migrate to another platform such as C# As I am making GUI in MATLAB for position tracking and localization. so in parallel I have to process more than one object at the same time.
Jan
Jan am 27 Jul. 2017
@Sairah: The need to track more than one object does not necessarily mean, that you need multi-threading. Although "multi" can be used to describe both points, there is not relation. Note that tracking mutliple objects still means, that you process one frame after the other.
Currently it does not seem to be a problem of the programming language, but of the understanding of the problem. A parallelization does not help at all, if the actual problem is the mutual concealing of the objects. While multi-threading is not only possible but an inherent part of Matlab, this matters how the data are processed internally only. There is no relation to the problem to track multiple object.
James Tursa
James Tursa am 27 Jul. 2017
@Jan +1 again
Sairah
Sairah am 27 Jul. 2017
Thanks james I have asked another question about GUI in this forum please have a look to it Because I really need a perfect guide line to prepare GUI that which platform is good?
Jan
Jan am 28 Jul. 2017
@Sairah: Please do not let use guess, which question you mean, but post a link.
Oindri
Oindri am 9 Jul. 2018
hi @Jan ! Please guide as to how to implement multithreading to an algorithm of mine and its calling C++ functions. Does Matlab MT mean underlying Java MT ?
Fatma Yörük
Fatma Yörük am 17 Jun. 2021
Hi @Jan. I exactly need the same guide with @Oindri. Please, provide us. Thank you.
Jan
Jan am 17 Jun. 2021
@Fatma Yörük: I did not understand, what Oindri is asking for. "Implement mutlithreading to an algorithm of mine" cannot be answered. That a C++ function is called does not reveal any detail also. I do not know, what "underlying Java MT" means.
Now you think you have the same question? Then please open a new thread and explain any details of your problem. Otherwise an answer is impossible.

Melden Sie sich an, um zu kommentieren.

Rashi Mehrotra
Rashi Mehrotra am 8 Okt. 2021

2 Stimmen

Hi Sairah,
The problem is similar to mine, in which data is received parallelly from two sensors.
Di you achieved the solution for your problem of multithreading, Please can you tell me.
Akhilesh Thakur
Akhilesh Thakur am 26 Jul. 2017

0 Stimmen

Parallel Computing Toolbox is a way to go. If you don't have it then you would have to built state machine which will execute sequentially. I did that way though it was not parallel. Let me know what kind of parallel programming you are looking for.

1 Kommentar

Sairah
Sairah am 27 Jul. 2017
hi Thakur. Actually I am new to this approach. thats why I am afraid that Matlab platform offers me to work on this or should I migrate to another platform such as C# As I am making GUI in MATLAB for position tracking and localization. so in parallel I have to process more than one object at the same time.

Melden Sie sich an, um zu kommentieren.

Kategorien

Gefragt:

am 26 Jul. 2017

Beantwortet:

am 8 Okt. 2021

Community Treasure Hunt

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

Start Hunting!