Viewing Java Objects Data

3 次查看(过去 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