Info

This question is closed. Reopen it to edit or answer.

How to use matlab.tall.reduce with user-defined classes?

2 views (last 30 days)
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?

Answers (0)

This question is closed.

Tags

Community Treasure Hunt

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

Start Hunting!