简体   繁体   中英

How to process [Ljava.lang.object in hashmap from XML-RPC in Matlab?

I'm trying to use the Apache XML-RPC Java client into Matlab, in combination with a python SimpleXMLRPCserver.

From the python server, I try to return a dictionary that is linking strings with lists, juts like the following:

return {'node15': [12,58748], 'node34': [28,45784]}

Then when calling the method from the maltab client, I end up with what matlab calls a hashmap:

{'node15' = [Ljava.lang.Object;@6f02ae95, node34 = [Ljava.lang.Object;@1913f123}

I didn't find a way to extract my list into arrays, my next step was to use values() to extract them, but it only returns a "HashMap$Values" list containing this:

[ [Ljava.lang.Object;@6f02ae95, [Ljava.lang.Object;@1913f12]

It looks like matlab failed to translate the java structure into something it understands.

Any idea what to do with this ?

您需要先将其转换为数组,然后您可以使用cell转换为Matlab本机类型:

cell(myHashMap.values().toArray());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM