Mercurial > hg > human-echolocation-java-webapp
comparison 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 |
comparison
equal
deleted
inserted
replaced
4:f6cffd6abce3 | 5:ac4aa1922f32 |
---|---|
15 //Instantiate Objects to null | 15 //Instantiate Objects to null |
16 MWStructArray Input = null; | 16 MWStructArray Input = null; |
17 | 17 |
18 HumanEcho echo; | 18 HumanEcho echo; |
19 | 19 |
20 | |
21 try { | 20 try { |
22 echo = new HumanEcho(); | 21 echo = new HumanEcho(); |
23 | 22 |
24 // Matlab function: | |
25 // a = struct('dist', 0.9, 'azim', 0, 'orient', 'horz', 'dirweight', 0.2) | |
26 | 23 |
27 // package input into MW Structure Array | 24 // Matlab structure: |
25 // Input = struct('dist', 0.9, 'azim', 0, 'orient', 'horz', 'dirweight', 0.2) | |
26 | |
28 String[] InputStructFields = {"dist", "azim", "orient", "dirweight"}; | 27 String[] InputStructFields = {"dist", "azim", "orient", "dirweight"}; |
29 Input = new MWStructArray(1, 1, InputStructFields); | 28 Input = new MWStructArray(1, 1, InputStructFields); |
30 Input.set("dist", 1, 0.9); | 29 Input.set("dist", 1, Double.valueOf(0.9)); |
31 Input.set("azim", 1, "azim"); | 30 Input.set("azim", 1, Double.valueOf(0)); |
32 Input.set("orient", 1, "horz"); | 31 Input.set("orient", 1, "horz"); |
33 Input.set("dirweight", 1, 0.2); | 32 Input.set("dirweight", 1, Double.valueOf(0.2)); |
34 | 33 |
35 Object[] result = echo.simulateBinauralSignals(Input); | 34 Object[] result = echo.simulateBinauralSignals(Input); |
36 | 35 |
37 MWNumericArray array = (MWNumericArray)result[0]; | 36 MWNumericArray array = (MWNumericArray)result[0]; |
38 //square = (double[][])array.toArray(); | 37 //square = (double[][])array.toArray(); |