Connect Android Application with a Matlab application on Server

后端 未结 1 809
渐次进展
渐次进展 2021-01-24 23:39

I am developing an application on Android which will take an input of an image and that input will be pass to a server where a MATLAB applicaion will be installed. The MATLAB ap

相关标签:
1条回答
  • 2021-01-25 00:15

    First, you'll need a web application server to receive stuff from your Android app. You can use anything you like, but which one you choose will probably influence how you deploy your MATLAB application.

    For that, you have three choices.

    1. Just install a copy of MATLAB on the server. Have your web application write images to some directory, have MATLAB sit there in a loop monitoring that directory, and when it sees a file, do its stuff, write the results out, and then continue monitoring the directory. Have your web application monitor the output directory and return the results to the user. You'll need a way of naming files to ensure that the right output matches the right input.

    Note that this option 1 is very restricted by the nature of the MATLAB license. You will only be able to provide access to users who are licensed for that copy of MATLAB, and for this reason it's not likely to be the right choice for you if you wish to make a make a publicly available Android app/service.

    1. Use either MATLAB Builder NE for .NET or MATLAB Builder JA for Java to convert and package your MATLAB application into a .NET assembly or a Java class. (If you've chosen a Microsoft web application server, choose the first, if it's another stack you'll probably want the second). Then have your web application call that component, passing it the image data and retrieving the results directly.

    Components deployed with the Builder products can be used and shared without the end user needing a MATLAB license, so that solves the main issue with option 1. Note that the Builder products are (somewhat expensive) add-on products to MATLAB.

    The problem with option 2 is scalability. You only have one MATLAB component there, and all requests will queue up to go through that. If you only have a few infrequent user requests that may be fine, otherwise you'll need to run a pool of multiple copies of the component, and you'll need to write some code to manage that pool and pass out requests to the components.

    You can either do that yourself (which may be hard), or you can go for

    1. Use MATLAB Production Server. This basically takes a component deployed with one of the Builder products above and does the pool management for you, communicating directly to the web application server. This is another add-on product (somewhat more expensive).

    My suggestion would be that unless you're looking to deploy a private app that can be properly licensed with option 1, I would choose option 2 to start with, see how it goes, then think about possibly scaling up with option 3.

    Note that there is one further option:

    1. Don't deploy your MATLAB application to a server at all. Instead, use MATLAB Coder (again an add-on product, but less expensive than Builders or certainly Production Server) to convert your application to C code. Then incorporate the C code directly into your Android app, to run on the device itself. This may be much easier to deploy, and significantly faster.
    0 讨论(0)
提交回复
热议问题