Viewing Java Objects Data

조회 수: 6 (최근 30일)
Mathew Guilfoyle
Mathew Guilfoyle 2013년 6월 28일
How do I go about extracting data from within a Java object? I am using a Java image analysis library and the main 'Image' object contains the pixel values themselves and some metadata (dimension, size, orientation etc). When I look at the object in the Matlab variable viewer it lists these various fields but I can't find a way of accessing them. e.g. d = Image.Dimension reports 'No appropriate method, property, or field dimension...'
fieldnames(Image,'-full') gives an empty cell array
The object does provide some methods to get certain field data, but not all. i.e. Image.getDimension works appropriately but there are other data without apparent set/get methods that I would like to access.
I'm confused as to why I can 'see' the data using the variable viewer but cannot access it programmatically? Is it to do with public/private fields? Can I circumvent this without reprogramming the Java classes?
Thanks for any pointers.

답변 (1개)

Malcolm Lidierth
Malcolm Lidierth 2013년 7월 1일
Try
methods(object)
You may find getDimension and is* methods that provide access to the fields.

카테고리

Help CenterFile Exchange에서 Call Java from MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by