Displaying a subclass of timeseries in the Variable Editor

5 views (last 30 days)
an object of the Matlab-builtin timeseries-class has a special appearance in the Variable Editor: the time-vector is displayed as vector of datestrings (if the neccessary properties are set correctly...) and the data-vector as-is, which is very useful when Debugging.
I have created a subclass MyTimeseries < timeseries to extend the functionality with some properties and methods. Everything works so far, but an object of this subclass MyTimeseries has not this special appearance in the Variable Editor - it is displayed as an ordinary class or struct variable.
Is there a way of changing this behaviour? So that i can extend the functionality of timeseries and have the nice display in the Variable Editor?
kind regards, Gregor

Accepted Answer

Daniel Shub
Daniel Shub on 8 Aug 2012
This question is very similar to this question about using the variable editor with a subclass of the dataset. In my answer I provide a method for forcing what you want by overloading the CLASS method to lie about the class of Mytimeseries. This efficentively fools the variable editor which makes use of proprietary aspects of com.mathworks.mlservices.MLArrayEditorServices. I went on to say in a comment that you do not want to do this since the variable editor is not going to know how to display any new properties that you add to your subclass. This is especially true since getting your class to work with an overloaded CLASS method is going to be a real pain.
I think the best thing to do is contact TMW and ask for a product enhancement that makes variable editor handle user classes better.
  1 Comment
Gregor on 8 Aug 2012
Thank you for your fast answer.!
The 'faked' class method in the subclass fools the Variable Editor, but the appearance is only partially correct. And as you said, there will be more problems and so i'm not going to use it. For the time being I use a simple converter method, that creates a copy of my MyTimeseries-object with class-type timeseries. Hoping that this issue is solved soon.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!