share data between workers while retrieving data from handle class within parpool
古いコメントを表示
Hey guys,
following problem.
I have a handle class which is linked to different handle class objects of its own class and of other classes.
So like i have 3 points and each points knows its position and to which points its is connected by an edge, called neighbour vertex in my case.
I now need to refine the edges connecting the points and I want to do this in parralel because there are many of these points and edges. At the same tome I have to relink the new edges and nes points to its neighbour points.

So in this example A,B,C are the old points and D and E are the new points. Additionaly I have to change the edges AB to AD and create a new edge DB, same goes for BC to BE and creating EC.
When doing this in parralel there is the problem the when the points as handle classes are a broacast variable that changes from another worker do not affect them. When worker 1 changes the connection from BC to BE and another worker changes the connection from BA to BD, they dont know from each other. It would results in two different B's with 2 different sets af neighbour points on each worker.
So how is this done in Matlab, especially with handle classes, since I even have problems to link vertices to each other in parrallel (without creating new ones), since somehow the chages are not reflected after parfor correctly to the editor even though I used all of the advices here:
They advise direct indexing, but I dont know which way would be more direct than:
parfor i=1:length(edges)
v1=vertex(edges(i,1));
v2=vertex(edges(i,2));
v1.neighbour_vertex(end+1)=v2;
v2.neighbour_vertex(end+1)=v1;
end
So this code does not work in aprfor, I dont get an error but I just get vertices back with 0 neighbours...
Maybe somebody culd help me eith this or give me a hint
Many thanks in advance
Best regards
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Graphics Performance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!