How to overload the @tabular.unstack method?
Mostrar comentarios más antiguos
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?
Respuestas (1)
Peter Perkins
el 23 de Nov. de 2021
0 votos
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 comentario
David Balla
el 24 de Nov. de 2021
Categorías
Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!