您好我使用javaoctave软件包从计算机桥接八度音程来执行一些计算。但是,我在编译时遇到以下错误:
error: save: Unrecognized option '-'
Exception in thread "main" dk.ange.octave.exception.OctaveIOException: IOException during close
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at dk.ange.octave.exec.OctaveExec.reInstantiateException(OctaveExec.java:184)
at dk.ange.octave.exec.OctaveExec.getFromFuture(OctaveExec.java:165)
at dk.ange.octave.exec.OctaveExec.eval(OctaveExec.java:142)
at dk.ange.octave.io.OctaveIO.get(OctaveIO.java:75)
at dk.ange.octave.OctaveEngine.get(OctaveEngine.java:161)
at dk.ange.octave.OctaveEngine.get(OctaveEngine.java:176)
at learn.capability.CapabilityMeanVarianceEquation.learnCapabilities(CapabilityMeanVarianceEquation.java:214)
at learn.graph.SimulatedAnnealingLearner.learnSynergyGraph(SimulatedAnnealingLearner.java:69)
at parse.basketball.runner.GetPlayerFrequency.learnSynergyGraph(GetPlayerFrequency.java:112)
at parse.basketball.runner.GetPlayerFrequency.main(GetPlayerFrequency.java:96)
Caused by: dk.ange.octave.exception.OctaveIOException: IOException during close
at dk.ange.octave.exec.OctaveReaderCallable.call(OctaveReaderCallable.java:65)
at dk.ange.octave.exec.OctaveReaderCallable.call(OctaveReaderCallable.java:28)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
Caused by: java.io.IOException: Pipe to octave-process broken
at dk.ange.octave.exec.OctaveExecuteReader.read(OctaveExecuteReader.java:68)
at java.io.Reader.read(Reader.java:123)
at dk.ange.octave.exec.OctaveExecuteReader.close(OctaveExecuteReader.java:96)
at dk.ange.octave.exec.OctaveReaderCallable.call(OctaveReaderCallable.java:61)
... 6 more
我不确定我是怎么遇到这个错误的。但是,我仔细检查了我的输入,所以我认为没有任何问题。我使用的程序之前已成功运行。
希望有人能提供帮助,谢谢!
答案 0 :(得分:2)
这涉及到一个" bug"存在于某些Octave版本中,其中" - " "保存"的选项命令不受尊重。这可能在Octave的更高版本中得到修复,但在此之前您可以像这样修改JavaOctave:
在DataReadFunctor.doReads(final Reader reader)
中,请注释以下内容:
// final String createByOctaveLine = readerReadLine(bufferedReader);
// if (createByOctaveLine == null || !createByOctaveLine.startsWith("# Created by Octave")) {
// throw new OctaveParseException("Not created by Octave?: '" + createByOctaveLine + "'");
// }
在OctaveIO.get(final String name)
中,修改以下行:
final WriteFunctor writeFunctor = new ReaderWriteFunctor(new StringReader("save -text - " + name));
到此:
final WriteFunctor writeFunctor = new ReaderWriteFunctor(new StringReader("save -text /dev/stdout " + name));
这些更改应该解决这个问题,或者至少让你朝着正确的方向前进,但我不建议将其作为修补程序,因为这个bug实际上是在某些版本的Octave中(文档'保存'确实说' - '是输出到终端而不是文件的有效选项。