How to overload the @tabular.unstack method?

조회 수: 6 (최근 30일)
David Balla
David Balla 2021년 11월 22일
댓글: David Balla 2021년 11월 24일
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?

답변 (1개)

Peter Perkins
Peter Perkins 2021년 11월 23일
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
David Balla
David Balla 2021년 11월 24일
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!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by