Let's say I want to define this in java :
package internet;
public class Downloader {
public enum DownloadStatus { INITIALIZING, IN_PROGRESS, COMPLETE };
}
How do I access the enum from matlab.
It seems that it works if the enum is defined outside of any class
(says Andrew here : http://stackoverflow.com/questions/1223795/using-java-enums-or-public-static-fields-in-matlab
) . But In this case, nothing seems to work in matlab
import internet.Downloader.DownloadStatus; does not work, it is not
recognized
internet.Downloader.DownloadStatus; does not work
internet.Downloader.DownloadStatus.INITIALIZING does not work
creating an empty object Downloader then trying to access
Downloadstatus does not work
I tried even the most stupid things, can't make it work
Why I want to do this ? Because there is a method in a java library
that asks for an enum type defined inside a class, so I need by any
means to create this enum type in matlab and pass it to the method as
a parameter.
Thanks for your help :)
You can try 'internet.Downloader$DownloadStatus' within the awtinvoke or javaMethod functions (this should work but I'm not 100% certain).
Alternately, use the method I used for system-tray messages, which has the same issue: http://undocumentedmatlab.com/blog/setting-system-tray-popup-messages/
Yair Altman
http://UndocumentedMatlab.com