Convert Composite to array?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Erik S.
el 28 de Mzo. de 2015
Comentada: Walter Roberson
el 1 de Dic. de 2020
Is it possible to convert a Composite object created with spmd to an array?
0 comentarios
Respuesta aceptada
Edric Ellis
el 30 de Mzo. de 2015
Yes, you can use Composite indexing (which behaves pretty much like cell array indexing), like this:
spmd
x = labindex;
end
xlocal = [x{:}]
2 comentarios
Walter Roberson
el 1 de Dic. de 2020
is there a faster way?
If I read the code correctly, you could use struct() to access private properties of the composite object, and then call some internal routines directly. It would take you a bit of research to figure out which routines to call on which objects, and you might have to shadow the existing class definitions to get access permissions to access the functions.
If I read the code correctly, if you did all of this, then for each composite member access, you would be able to skip one check of whether you are inside a parfor loop. Should be good for about 3 milliseconds per pool member.
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrices and Arrays en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!