210 6. CONTINUOUS-TIME FOURIER TRANSFORM
public static native float[] compute( float[] in, int Fs,
int choice, int frameSize );
7. To make sure the coefficient input is applied to the settings, update the
updateSettings() method in app/src/main/java/com/dsp/matlab/RealTime.java
and add the following line within. e previous settings for resistance, capacitance,
coefficients, frequency, and system can be removed.
Settings.setChoice(Integer.parseInt(
preferences.getString("choice1","0")));
8. Update app/src/main/java/com/dsp/matlab/Settings.java to store and retrieve the settings
added. Again the resistance, capacitance, coefficients, frequency, and system-related vari-
ables and methods can be removed.
public static float choice = 0;
public static void setChoice(int choice1){choice=choice1;}
9. Finally, update the app/src/main/jni/MatlabNative.c interface file. is file is the interface
from Java to native C. e entire file is listed below.
#include <jni.h>
#include <stdio.h>
#include ''rt_nonfinite.h''
#include ``LR6_2.h''
#include ``LR6_2_terminate.h''
#include ``LR6_2_emxAPI.h''
#include ``LR^_2_intialize.h''
jfloatArray
Java_com_dsp_matlab_Filters_compute(JNIEnv *env, jobject this,
jfloatArray, input, jint Fs, jint choice, jint frameSize)
{
jfloatArray output = (*env)->NewFloatArray(env, frameSize);
float *_in = (*env)->GetFloatArrayElements(env, input, NULL );
//compute
emxArray_real32_T *result;