How to overload the @tabular.unstack method?
1 view (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
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.
See Also
Categories
Find more on Data Type Identification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!