view webapp/WEB-INF/src/TestEchoClass.java @ 5:ac4aa1922f32

Calling the simulateBinauralSignals function using a structure (new interface).
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Wed, 27 Nov 2013 17:41:10 +0000
parents f6cffd6abce3
children 76f809129f98
line wrap: on
line source
import com.mathworks.toolbox.javabuilder.MWJavaObjectRef;
import com.mathworks.toolbox.javabuilder.MWNumericArray;
import com.mathworks.toolbox.javabuilder.MWStructArray;
import com.mathworks.toolbox.javabuilder.MWException;

import uk.ac.soton.isvr.*;

public class TestEchoClass {
    int test = 4;
    double[][] square = new double[0][];

    public static void main(String[] args) {
        System.out.println("YOOOOOO, Bs");

        //Instantiate Objects to null
        MWStructArray Input = null;

        HumanEcho echo;

        try {
            echo = new HumanEcho();


            // Matlab structure:
            // Input = struct('dist', 0.9, 'azim', 0, 'orient', 'horz', 'dirweight', 0.2)

            String[] InputStructFields = {"dist", "azim", "orient", "dirweight"};
            Input = new MWStructArray(1, 1, InputStructFields);
            Input.set("dist", 1, Double.valueOf(0.9));
            Input.set("azim", 1, Double.valueOf(0));
            Input.set("orient", 1, "horz");
            Input.set("dirweight", 1, Double.valueOf(0.2));

            Object[] result = echo.simulateBinauralSignals(Input);

            MWNumericArray array = (MWNumericArray)result[0];
            //square = (double[][])array.toArray();

        }
        catch(MWException e) {
            e.printStackTrace();
        }

    }

}