How to overload the @tabular.unstack method?

1 view (last 30 days)
David Balla
David Balla on 22 Nov 2021
Commented: David Balla on 24 Nov 2021
For very big tables (e.g. 1e7 x 555) unstack runs into out of memory error only due to the logical indexing in line 279:
% Explicitly fill in elements of the wide variable that received no
% tall values.
fillLocs = ~accumarray({jdx,kdx},1,[nrowsWide,nwideVars]);
wideVars_k(fillLocs) = fillVal;
This is easily solved by splitting the value and index arrays first and concatenating second (or alternative solutions). Hovewer, unstack has several dependencies on the tabular class and this class cannot serve as a superclass for custom subclasses:
classdef (AllowedSubclasses = {?timetable ?table}) tabular < matlab.mixin.internal.indexing.DotParen & matlab.internal.datatypes.saveLoadCompatibility
% Internal abstract superclass for table and timetable.
% This class is for internal use only and will change in a future release. Do not use this class.
% Copyright 2016-2019 The MathWorks, Inc.
Is there a sensible way to overload / customize unstack or to solve this use case in a different way?

Answers (1)

Peter Perkins
Peter Perkins on 23 Nov 2021
David, if you "own" your MATLAB installation, there's nothing preventing you from directly modifying unstack.
What I'd suggest, though, is to first contact support with an example of the data that leads to the problem, and see if you can get advice on a work-around, or at least on your proposed change.
  1 Comment
David Balla
David Balla on 24 Nov 2021
Dear Peter, thank you for your answer!
Actually, I did the modification on unstack on my local installation. That is why I know at least one possible solution for the huge matrix indexing problem.
However, I am developing industrial data evaluation in matlab using also unstack and I need to deploy my scripts integrated in a SW-system for internal customers.
I will follow your suggestion and contact the support. Thanks!

Sign in to comment.

Categories

Find more on Data Type Identification in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!