Viewing Java Objects Data

3 visualizzazioni (ultimi 30 giorni)
Mathew Guilfoyle
Mathew Guilfoyle il 28 Giu 2013
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.

Risposte (1)

Malcolm Lidierth
Malcolm Lidierth il 1 Lug 2013
Try
methods(object)
You may find getDimension and is* methods that provide access to the fields.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by