外部インタフェース/API | ![]() ![]() |
オブジェクトのパブリックデータフィールドの検索
Javaオブジェクトに属するパブリックフィールドをリストするには、つぎのいずれかの形式のfieldnames
関数を使います。
names = fieldnames(obj) names = fieldnames(obj,'-full')
'-full'
を付けずにfieldnames
を呼び出すと、オブジェクトのすべてのデータフィールド(継承を含む)名を出力します。'-full'
修飾子を付けると、fieldnames
は、タイプ、属性、継承の情報を含むオブジェクトに対して定義されたデータフィールドの詳しい説明を出力します。
たとえば、以下を使ってFrame
オブジェクトを作成したとします。
frame = java.awt.Frame;
frame
のデータフィールドの詳しい情報を得るには、以下のコマンドを使います。
fieldnames(frame,'-full')
ans = 'static final int WIDTH % Inherited from java.awt.image.ImageObserver' 'static final int HEIGHT % Inherited from java.awt.image.ImageObserver' [1x74 char] 'static final int SOMEBITS % Inherited from java.awt.image.ImageObserver' 'static final int FRAMEBITS % Inherited from java.awt.image.ImageObserver' 'static final int ALLBITS % Inherited from java.awt.image.ImageObserver' 'static final int ERROR % Inherited from java.awt.image.ImageObserver' 'static final int ABORT % Inherited from java.awt.image.ImageObserver' 'static final float TOP_ALIGNMENT % Inherited from java.awt.Component' 'static final float CENTER_ALIGNMENT % Inherited from java.awt.Component' 'static final float BOTTOM_ALIGNMENT % Inherited from java.awt.Component' 'static final float LEFT_ALIGNMENT % Inherited from java.awt.Component' 'static final float RIGHT_ALIGNMENT % Inherited from java.awt.Component'.
.
.
![]() | JavaオブジェクトのMAT-ファイルへの保存とロード | プライベートおよびパブリックデータのアクセス | ![]() |