Why can't you subclass table?

15 vues (au cours des 30 derniers jours)
Victor
Victor le 17 Août 2015
Commenté : Jan Kappen le 11 Déc 2019
I am looking to subclass table to imbue it with some of the functionality in Python's pandas - namely, the ability to classify certain columns as indices and leave them out of basic operations between tables. Is there any reason why one is not allowed to subclass table? Or if I am mistaken, how does one go about subclassing table? Thanks in advance.

Réponses (2)

Steven Lord
Steven Lord le 17 Août 2015
No one complains about a backwards incompatibility if you take a class that started off Sealed and make it unSealed. Few (if any) people tend to complain if you make something that used to error now work.
People tend to be rather upset, with good reason, if you take a class that started off unSealed and make it Sealed.
My suspicion is that no one offered a compelling reason to make the table class unSealed, so it defaulted to Sealed. I recommend that you contact Technical Support and ask them to submit an enhancement in the enhancement database with the features with which you would like to imbue the table class and your use case (how you would use those features and/or why you want to use those features.) It's possible that could be a compelling reason to unseal the table class, or it might be compelling enough to warrant inclusion in the table class itself.

Walter Roberson
Walter Roberson le 17 Août 2015
Built-In Types You Cannot Subclass
You cannot subclass the following built-in MATLAB classes:
* char
* cell
* struct
* table
* function_handle
All of those except for table I recognize as being fundamental data types implemented in C / C++. I see in R2014a table.m that table is implemented by classdef. I do not know why table cannot be subclassed other than it is So Documented.
  1 commentaire
Jan Kappen
Jan Kappen le 11 Déc 2019
I guess, Mathworks will want to make this table a built-in datatype to increase performance. It's terrible i.e. compared to Python's Pandas. Nevertheless I love tables in Matlab and would like to subclass them, too but I guess that won't happen.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by