Matlab/GNU Octave中的R like str()函数 [英] R like str() function in matlab/GNU Octave

查看:100
本文介绍了Matlab/GNU Octave中的R like str()函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够像在R中一样,在Matlab/GNU Octave中查看对象的结构(使用

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 example task would be returning nr rows and cols in matrix, but also all the arguments for a given function.

我知道我可以同时使用 size() help() (但不是分别获取功能文件)的信息.

I'm aware that I could use both size() and help() (but not for function files) separately to get this information.

推荐答案

有几个有用的函数可以显示一些有关Matlab对象的信息(我不能说任何有关Octave兼容性的信息),但是我不确定它们是否会提供与R的str()相同的详细信息.您可以使用 methods 显示类的所有方法.功能,例如:

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')

返回

Methods for class MException:

 addCause       getReport      ne             throw          
 eq             isequal        rethrow        throwAsCaller  

 Static methods:

 last

what 函数将返回相似的结果.或methods可用于给定类的对象:

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)

类似地,您可以使用 properties events .

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

这篇关于Matlab/GNU Octave中的R like str()函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆