0

我正在使用 MatLab2013a 64 位和 Java7。我想做的是通过javabuilder从Java调用一个matlab函数,我创建了一个matlab项目来编译这个函数,以下是我的matlab函数

function SP=imagerotate(filename,theta)
    I=imread(filename);
    SP=imrotate(I,theta);

然后我将它添加到一个名为的类中RotateImage(这是编译 Matlab 函数的常用过程)。并且没有发生错误。然后我创建一个 Java 项目并添加distrib\flying.jarC:\Program Files\MATLAB\MATLAB Compiler Runtime\v81\toolbox\javabuilder\jar\javabuilder.jar. 当我尝试测试它时,发生了错误。

包装图片;

import com.mathworks.toolbox.javabuilder.MWClassID;
import com.mathworks.toolbox.javabuilder.MWNumericArray;
import flying.RotateImage;

/**
 * Created with IntelliJ IDEA.
 * User: ssj-at-work
 * Date: 13-9-22
 * Time: 上午11:00
 * To change this template use File | Settings | File Templates.
 */
public class Main {
    public static void main(String args[]) {
        try {
            System.out.println("Begin");
            RotateImage flyingDraw = new RotateImage();
            System.out.println("Middle");
            MWNumericArray theta = new MWNumericArray(90, MWClassID.INT16);
            String filename=new String("C:\\Users\\ssj-at-work\\Desktop\\Picture\\GN20130625_1.jpg");
            Object img[]=null;
            img=flyingDraw.imagerotate(1,filename,theta);
            int[] k=((MWNumericArray) img[0]).getDimensions();
            for (int i:k){
                System.out.println(i);
            }
            System.out.println("Here");
        } catch (Exception e) {
            System.out.println(e);
        }
    }
}

错误信息如下

Invalid MEX-file 'F:\Program Files\MATLAB\R2013a\mcr\toolbox\matlab\imagesci\private\rjpg8c.mexw64': 找不到指定的模块。

Error in readjpg (line 12)



Error in imread (line 416)



Error in imagerotate (line 2)



Unable to print provided exception.

Caused by:
    Errors occurred while loading the Settings files. 
    Details: F:\Program Files\MATLAB\R2013a\toolbox\matlab\matlab.settings  Internal Error: Failed to find SAX plugin.
    C:\Users\SSJ-AT~1\AppData\Local\Temp\ssj-at-work\mcrCache8.1\flying0\.matlab\matlab.settings    Internal Error: Failed to find SAX plugin.
    There is no Settings files associated with this product node: matlab. The Settings files may be deleted after MATLAB started up. Please restart MATLAB to fully solve this issue.
    .


Process finished with exit code 255

请帮帮我。

4

1 回答 1

0
  1. 确保与 MCR 8.1 对应的 \v81\bin\win64 在系统 PATH 环境变量中比与 MCR 8.0 对应的环境变量提前。
  2. 解决方法是将以下条目显式添加到系统 PATH:\v81\bin\win64
于 2013-10-18T14:00:32.090 回答