R like str() function in matlab/GNU Octave

后端 未结 1 873
孤城傲影
孤城傲影 2020-12-19 17:09

I\'d like to be able to view the structure of objects in Matlab/GNU Octave the same way as I do in R (using the str() function). Is there a function that does this? An examp

相关标签:
1条回答
  • 2020-12-19 18:06

    There are several useful functions for displaying some information about Matlab objects (I can't say anything about Octave compatibility), but I'm not sure they'll provide the same detail as R's str(). You can display all of the methods of a class with the methods function, e.g.:

    methods('MException')
    

    which returns

    Methods for class MException:
    
     addCause       getReport      ne             throw          
     eq             isequal        rethrow        throwAsCaller  
    
     Static methods:
    
     last
    

    The what function will return similar results. Or methods can be used on an object of a given class:

    ME = MException('Test:test','Testing');
    methods(ME)
    

    Similarly, you can view the properties with properties and the events with events.

    0 讨论(0)
提交回复
热议问题