1

これで私を助けてください!javaからmatlabcontrolを使用してmatlab関数を呼び出そうとすると、システムが指定されたファイルを見つけることができなかったことが通知されます。

package matcontro;

import matlabcontrol.*;

public class HelloWorld

 {

      public static void main(String[] args) throws MatlabConnectionException, MatlabInvocationException
     {
         // create proxy
         MatlabProxyFactoryOptions options = new MatlabProxyFactoryOptions.Builder()
                 .setUsePreviouslyControlledSession(true)
                 .build();
         MatlabProxyFactory factory = new MatlabProxyFactory(options);
        MatlabProxy proxy = factory.getProxy(); 

         // call builtin function
         proxy.eval("disp('hello world')");

         // call user-defined function (must be on the path)
         proxy.eval("addpath('C:\\ Users\\HASENDE\\My Documents\\MATLAB')");
         proxy.feval("myfunc");
         proxy.eval("rmpath('C:\\ Users\\HASENDE\\My Documents\\MATLAB')");

         // close connection
         proxy.disconnect();
     }
 }

私が得るエラーは以下の通りです。

走る:

Exception in thread "main" matlabcontrol.MatlabConnectionException: Could not launch MATLAB. Command: [matlab, -r, javaaddpath 'C:\Users\HASENDE\Documents\NetBeansProjects\Java Classpath Libraries\matlabcontrol-4.0.0.jar'; matlabcontrol.MatlabClassLoaderHelper.configureClassLoading(); javarmpath 'C:\Users\HASENDE\Documents\NetBeansProjects\Java Classpath Libraries\matlabcontrol-4.0.0.jar'; matlabcontrol.MatlabConnector.connectFromMatlab('PROXY_RECEIVER_01caa56d-9ed7-4e39-a45b-345051024d49', 2100);]

at matlabcontrol.RemoteMatlabProxyFactory.createProcess(RemoteMatlabProxyFactory.java:305) at matlabcontrol.RemoteMatlabProxyFactory.requestProxy(RemoteMatlabProxyFactory.java:116)

at matlabcontrol.RemoteMatlabProxyFactory.getProxy(RemoteMatlabProxyFactory.java:134)

    at matlabcontrol.MatlabProxyFactory.getProxy(MatlabProxyFactory.java:81)

    at matcontro.HelloWorld.main(HelloWorld.java:21)

Caused by: java.io.IOException: Cannot run program "matlab": CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) at matlabcontrol.RemoteMatlabProxyFactory.createProcess(RemoteMatlabProxyFactory.java:292) ... 4 more

Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified

    at java.lang.ProcessImpl.create(Native Method)

    at java.lang.ProcessImpl.<init>(ProcessImpl.java:188)

    at java.lang.ProcessImpl.start(ProcessImpl.java:132)

    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1021)   ... 5 more

Java Result: 1

BUILD SUCCESSFUL(合計時間:4秒)

4

0 に答える 0