Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
How to use matlab.tall.reduce with user-defined classes?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a custom class with, among other things, an overloaded "plus" method. The class is defined such that summing several objects constructed from blocks of data is equal to a single object constructed from the concatenation of those blocks, e.g.
% assuming vectors of data t1, t2, and t3 are already defined
t123 = [t1;t2;t3];
sumObj = myClass(t1)+myClass(t2)+myClass(t3);
catObj = myClass(t123);
% then sumObj is "equal" to catObj (or a duplicate or whatever)
What I'd like to do is make this work for tall array inputs. For various reasons, it is difficult for me to modify the constructor to do the same calculations with a tall array (many unsupported calculations), so I thought I could take advantage of matlab.tall.reduce by including a method with something that looks like:
if istall(t)
% take advantage of the fact that I can split t into blocks and then sum all the objects together
obj = matlab.tall.reduce(@myClass,@sum,t);
end
But when I try this, I get an error about tall arrays not being allowed to contain data of my class. Is there something simple I can do to fix this in order to make my class tall-compatible?
0 comentarios
Respuestas (0)
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!