Viewing Java Objects Data
3 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Malcolm Lidierth
on 1 Jul 2013
Try
methods(object)
You may find getDimension and is* methods that provide access to the fields.
0 Comments
See Also
Categories
Find more on Call Java from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!