Matlab java interop. Use enum values

2 次查看(过去 30 天)
Vladimir
Vladimir 2012-11-27
Hello!
I have java enum
package com.moc;
public enum MyType {
s,
q,
p,
none,
}
In matlab(2012a) I load appropriate jar, and set
a = com.moc.MyType.q;
a = com.moc.MyType.none;
It works as well. But when i try to eval
a = com.moc.MyType.s;
or
a = com.moc.MyType.p;
I get an exception
The class com.moc.MyType has no property or method named 's'.
and
The class com.moc.MyType has no property or method named 'p'.
Why did matlab disallow me to get 's' and 'p' enum values?
Thank you
P.S.
a = com.moc.MyType.q;
a.getClass.getDeclaredField('p')
returns
public static final com.moc.MyType com.moc.MyType.p

回答(0 个)

类别

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