Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I copy a MATLAB libsvm model to android application folder

How do I copy the trained libsvm model (I have a file called data.txt) from MATLAB to my phone? I don't know the folders I should save it to and how to load it in my actual app.

I am running the adb shell command via my computer and I am in the directory /data/data/edu.umich.eecs.androidlibsvm

I can only see these folders:

shell@A0001:/data/data/edu.umich.eecs.androidlibsvm $ ls
cache
lib
shell@A0001:/data/data/edu.umich.eecs.androidlibsvm $ cd lib
shell@A0001:/data/data/edu.umich.eecs.androidlibsvm/lib $ ls
libjnilibsvm.so
shell@A0001:/data/data/edu.umich.eecs.androidlibsvm/lib $ 
like image 768
MReyman Avatar asked Jan 28 '26 17:01

MReyman


1 Answers

From what I can understand from your question, you basically want to do 2 things

  1. Push filename.extension to your device
  2. Access this file from your app i.e read/load it in your app.

So I am going to answer as per the above stages

  1. Use adb push command to transfer the file from your system to the device

    adb push filename.extension /sdcard/0/<public_folder>

where <public_folder> could be Download

  1. To read/load this file you only need to use Environment.getExternalStoragePublicDirectory()

    Reference Link from Android Docs

Note : The whole process can be adapted to work with internal storage too, but I am assuming you want the file to be publically available to apps.

like image 88
Nishant Srivastava Avatar answered Jan 31 '26 08:01

Nishant Srivastava



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!