简体   繁体   English

将OmniDriver从Matlab迁移到Octave。 是否需要找到Octave的librarypath.txt?

[英]Migrating OmniDriver from Matlab to Octave. Need to find librarypath.txt for Octave?

I currently use Matlab and the Ocean Optics Omnidriver ( http://oceanoptics.com/faq/controlling-usb-spectrometers-omnidriver-matlab/ ) to control a USB spectrometer on a windows 7 machine, and I'm trying to migrate to Octave. 我目前使用Matlab和Ocean Optics Omnidriver( http://oceanoptics.com/faq/controlling-usb-spectrometers-omnidriver-matlab/ )来控制Windows 7机器上的USB光谱仪,并且我正尝试迁移到八度。

Omnidriver is written in Java, and there is reasonable documentation for Matlab. Omnidriver用Java编写,并且有适用于Matlab的合理文档。 After installing the driver the relevant Matlab commands are: 安装驱动程序后,相关的Matlab命令为:

>> javaaddpath('C:\Program Files\Ocean Optics\OmniDriver\OOI_HOME\OmniDriver.jar');
>> wrapper = com.oceanoptics.omnidriver.api.wrapper.Wrapper();
>> wrapper.openAllSpectrometers();

the first line seems to translate directly once the '\\' are replaced with '/', and I can see the file added to the dynamic java path. 一旦将'\\'替换为'/',第一行似乎直接翻译,我可以看到文件已添加到动态Java路径中。

The second line directly throws "error: 'com' undefined", but replacing with; 第二行直接抛出“错误:'com'未定义”,而是替换为;

>> wrapper = javaObject ("com.oceanoptics.omnidriver.api.wrapper.Wrapper")

seems to work. 似乎有效。

The third line directly then throws the error; 第三行直接引发错误; "error: [java] java.lang.NoClassDefFoundError: Could not initialize class com.oceanoptics.uniusb.UniUSB" “错误:[java] java.lang.NoClassDefFoundError:无法初始化com.oceanoptics.uniusb.UniUSB类”

which is where I'm stuck at the moment (UniUSB.jar is a file in OOI_HOME). 这就是我目前停留的位置(UniUSB.jar是OOI_HOME中的文件)。 On the OceanOptics page linked above, what I'm assuming is the same error is listed as a common problem caused by Matlab failing to find the required DLLs, and the solution is given as adding the path to OOI_HOME to matlabroot/toolbox/local/librarypath.txt 在上面链接的OceanOptics页面上,我假设是相同的错误,这是由Matlab找不到所需的DLL引起的常见问题,并且给出的解决方案是将OOI_HOME的路径添加到matlabroot / toolbox / local / librarypath.txt

I'm assuming that if I can find the equivalent octave file then adding the path should solve my problem, but I can't find the file. 我假设如果可以找到等效的八度音阶文件,则添加路径应该可以解决我的问题,但是找不到该文件。

Any advice would be greatly appreciated! 任何建议将不胜感激!

The code 编码

>> javaaddpath('C:\Program Files\Ocean Optics\OmniDriver\OOI_HOME\OmniDriver.jar');
>> wrapper = com.oceanoptics.omnidriver.api.wrapper.Wrapper();
>> wrapper.openAllSpectrometers();

translates better with: 可以更好地翻译:

wrapper = javaObject ("com.oceanoptics.omnidriver.api.wrapper.Wrapper");
javaMethod ("openAllSpectrometers", wrapper);

Note that this is also valid Matlab syntax. 请注意,这也是有效的Matlab语法。

Another thing is that Octave handles java classes better if they are on the static classic path. 另一件事是,如果Octave位于静态经典路径上,则它们可以更好地处理Java类。 So I'd recommend you add the path to OmniDriver.jar to your javaclasspath.txt file. 因此,我建议您将OmniDriver.jar的路径添加到javaclasspath.txt文件中。 See the manual for details . 有关详细信息,请参见手册

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM