MATLAB Builder JA dependency

I try to run MATLAB code in Java with MATLAB Builder JA to get the JAR file. test.m works fine, but not the test2.m that depends on test.m.

I need the dependency for my project, how to set it up?

test.m

function [out1] = test(n)
out1 = magic(n);

test2.m

function [a] = test2()
a = test();

After building and packaging with Builder JA and run it in Eclipse.

package testJava;

import test.*;
import com.mathworks.toolbox.javabuilder.*;

public class Test {

    public static void main(String[] args){
        testclass a = null;
        Object[] result = null;

        try {
            a = new testclass();
            result = a.test2(1,2);
            System.out.println(result[0]);
        } catch (MWException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

test2 is not working but test is working. How do I make test2 work?

Answers


One problem is that test2 doesn't actually take any input arguments, but test requires one.

Try re-writing test2 as

function a = test2(in)
a = test(in);

Also, you should call test2 in you code with only a single input.


Need Your Help

Swift: TableView controller and segment value change

ios uitableview swift tableviewcell

I hope you can help me on this question as I'm a bit stuck...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.