Clear Filters
Clear Filters

Viewing Java Objects Data

2 views (last 30 days)
Mathew Guilfoyle
Mathew Guilfoyle on 28 Jun 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.

Answers (1)

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

Tags

Community Treasure Hunt

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

Start Hunting!