Is it possible to construct a parameterized class in Matlab? For example in Java I could say ArrayList
. I h
Kurt is right, however a workaround would be to define your own java class that's not parameterized. public class MyList extends ArrayList<String> { }
. Then in matlab you could write myList = MyList()
and you would get almost all of the same method signatures as ArrayList<String>
.
You can't instantiate a parametrized Java class in Matlab. This is because Matlab is an interpreted language. So, in your example, when you try
myList = java.util.ArrayList<String>()
This code is immediately interpreted and run by Matlab (and the Java code compiled). But because Java has Type Erasure all type information for myList is immediately lost. This means in the context of Matlab syntax type parameters make no sense -- so they are syntactically invalid.
I am not a specialist in Matlab but I understand something in java.
It means that
The following link could probably help you: http://www.mathworks.com/support/solutions/en/data/1-1812J/