到目前为止我的代码(基于此条目)但它不起作用:
MatFileReader matfilereader = new MatFileReader("C:\\data\\Freebase\\initEmbed.mat");
System.out.println(matfilereader.getData().get(0) + "name: "+matfilereader.getMLArray("words").getSize());
System.out.println("new "+matfilereader.getMLArray("words"));
MLArray words = matfilereader.getMLArray("words");
System.out.println(words.contentToString().substring(0, 100));
MLChar j = (MLChar) matfilereader.getMLArray("words");
我的输出:
[1x91898 cell array]name: 91898
new [1x91898 cell array]
words =
[1x9 char array] [1x3 char array] [1x1 char array] [1x1 char array] [1x2 char array]
Exception in thread "main" java.lang.ClassCastException: com.jmatio.types.MLCell cannot be cast to com.jmatio.types.MLChar
at NTN.Run_NTN.main(Run_NTN.java:91)
如何将此matlab文件的单词加载到java数组中?