Why can't you subclass table?
조회 수: 14 (최근 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!