Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How do I pass a struct to a java hashtable?

Subject: How do I pass a struct to a java hashtable?

From: Enter The

Date: 10 Mar, 2010 20:29:47

Message: 1 of 2

I have a struct in matlab that I want to store in a java hashtable,
however, when I use the hashtable.put function I get:

??? No method 'put' with matching signature found for class
'java.util.Hashtable'.

Subject: How do I pass a struct to a java hashtable?

From: Yair Altman

Date: 13 Mar, 2010 22:40:25

Message: 2 of 2

Enter The <enterthe@walla.com> wrote in message <09ef80db-8e98-438e-ad5e-df70f226214b@j27g2000yqn.googlegroups.com>...
> I have a struct in matlab that I want to store in a java hashtable,
> however, when I use the hashtable.put function I get:
>
> ??? No method 'put' with matching signature found for class
> 'java.util.Hashtable'.


That's indeed problematic. Java does not have a native type that corresponds to a Matlab struct. You can either create a Java class that maps to the struct, or if you have Matlab R2008b (7.7) or later you can use the built-in containers.Map function, which is a scaled-down Matlab version of the java.util.Map interface.

Also see: http://stackoverflow.com/questions/436852/storing-matlab-structs-in-java-objects

Note that the recently-released R2010a (7.10) added a containers.Map functionality of specifying the expected data types.

Yair Altman
http://UndocumentedMatlab.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us