连接Android应用程序与MATLAB应用在服务器上 [英] Connect Android Application with a Matlab application on Server

查看:199
本文介绍了连接Android应用程序与MATLAB应用在服务器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发Android电子应用程序,这将拍摄图像的输入,并且输入将被传递给其中一个MATLAB applicaion将安装的服务器。 在MATLAB应用程序将计算结果和将其返回到Android应用程序。

我想知道哪个服务器我将能够使用? 如何MATLAB应用程序将被安装到服务器?

解决方案

首先,你需要一个Web应用服务器从你的Andr​​oid应用程序获得的东西。您可以使用您选择任何你喜欢的,但哪一个可能会影响你如何部署MATLAB应用。

有关这一点,你有三种选择。

  1. 只需在服务器上安装MATLAB的副本。让你的Web应用程序写入图像到某个目录,有MATLAB坐在那里在一个循环中监控该目录,当它看到一个文件,尽自己的东西,结果写出来,然后继续监测目录。让你的Web应用程序监视输出目录,并将结果返回给用户。你需要命名文件的方式,以确保正确的输出正确的输入相匹配。

请注意,此选项1是非常受的MATLAB牌照的性质的限制。您将只能够提供对谁被授权为MATLAB的副本用户,并为这个原因,它不太可能,如果你希望做一个让公众可用的Andr​​oid应用程序/服务是您正确的选择。

<醇开始=2>
  • 使用或者MATLAB生成器NE的.NET或MATLAB生成器JA for Java来转换和打包MATLAB应用到.NET程序集或Java类。 (如果您选择的是Microsoft Web应用程序服务器,选择第一个,如果它是你可能会想第二另一叠)。然后让你的Web应用程序调用组件,传递给它的图像数据,并直接检索结果。
  • 部署与生成器产品组件可以使用和共享无需最终用户需要一个MATLAB牌照,使之与选项1.注意解决的主要问题,该生成器产品是(有点贵)附加产品MATLAB。

    与选项2的问题是可扩展性。您只有一个MATLAB分量在那里,所有的请求都排队要经过。如果你只有有可能被罚款数罕见的用户请求,否则你将需要运行的组件的多个副本,一个游泳池,你会需要编写一些code管理该池和传递出的请求到的组件。

    您可以做自己(可以是硬),或者你可以去

    <醇开始=3>
  • 使用MATLAB生产服务器。这基本上需要部署的生成器产品上面的一个组成部分,并执行池管理你的,直接传达给Web应用程序服务器。这又是一个附加产品(有点更贵)。
  • 我的建议是,除非你正在寻找部署私有应用程序,可适当行货带选项1,我会选择选项2,首先,看看怎么回事,后来想想可能扩大与选3

    请注意,有一个另外的选择:

    <醇开始=4>
  • 请不要部署MATLAB应用到服务器上的。相反,使用MATLAB codeR(又是一个附加产品,但比建筑商或肯定生产服务器更便宜),您的应用程序到C code转换。然后直接纳入C code转换你的Andr​​oid应用程序,设备本身上运行。这可能是更容易部署,并显著更快。
  • 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 application will compute the results and will return it to that android app.

    I want to know which server will i be able to use? How MATLAB application will be installed to that server?

    解决方案

    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.

    这篇关于连接Android应用程序与MATLAB应用在服务器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆