Why can't you subclass table?
15 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Steven Lord
2015-8-17
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 个评论
Walter Roberson
2015-8-17
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 个评论
Jan Kappen
2019-12-11
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!