Hi Alex,
I Understand that you want to run your signal processing heavy matlab script on button click in your Kotlin/Java android app.
Running MATLAB scripts for signal processing in Kotlin/Java Android apps isn't directly supported. Consider these workarounds:
1.Using MATLAB Compiler SDK
- Use MATLAB Compiler SDK to compile your MATLAB script into a Java library.
- Deploy this library on a web server as a part of a web application (e.g., using a framework like Spring Boot for Java).
- From your Android app, make HTTP requests to the web application, sending the CSV file as input and receiving the processed results back.
2.Port MATLAB Code to Kotlin/Java
For functions like butter, you might find equivalent libraries in Java or Kotlin, or you can implement the algorithm directly in Kotlin/Java.
Steps:
- Translate your MATLAB script to Kotlin, replicating the signal processing functionality.
- Use Android’s built-in sensors API to collect accelerometer data.
- Process the data within the app without needing to call out to MATLAB.
Pros: Fully offline solution, no need for network requests or external processing.
I hope it helps!