Why can't you subclass table?
14 views (last 30 days)
Show older comments
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.
0 Comments
Answers (2)
Steven Lord
on 17 Aug 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.
0 Comments
Walter Roberson
on 17 Aug 2015
This is documented at http://www.mathworks.com/help/matlab/matlab_oop/subclassing-matlab-built-in-classes.html
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 Comment
Jan Kappen
on 11 Dec 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.
See Also
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!