Matlab and websites (Web integrating)
29 views (last 30 days)
Show older comments
I have a project where I will utilizing image processing and neural networks. The tool that I am using for this is matlab. The system is a web based system and the examples I have seen and worked with is currently desktop based. Does anyone know how I would create a website layer on top of the image processing and neural network part?
The simplest structure would be something like
Web site -> Provide input -> Process through image processing and neural networks -> Provide output in the website
The most simple way would be to use Java and call some matlab program in the server and have matlab write to the database with the output, how would I accomplish this? How would I host the matlab code in the server and the java code at the same time? How would I write to the mysql using Matlab? This would be the current primary question that requires answering
While this would work, additionally if possible I would also like to have the website more interactive with the process, like when I wan't to control the intensity for some threshold in some part regarding image processing (Perhaps compiling the matlab code into a jar and integrating)
Additionally I also require to write to a database, mysql if possible
It would be a bonus if I could combine Java EE with matlab as I already have code which I can use from java. Howeve the mandatory requirement is that I create a website which can get the job done
Regards, Milinda
0 Comments
Answers (2)
Juan B. Gutierrez
on 18 May 2012
About your questions:
Does anyone know how I would create a website layer on top of the image processing and neural network part?
YES! It is actually quite simple. You have to package your MATLAB component and use it as a class in your web technology. As mentioned in a previous answer, you loose the GUI, but the numeric functionality (and the ability create plots, files, etc) remains the same. See details in the next paragraphs.
The most simple way would be to use Java and call some matlab program in the server and have matlab write to the database with the output, how would I accomplish this?
Depending upon the number of concurrent users in your web server, you might NOT want to simply call a MATLAB executable from your Java web application. You probably want to use shared memory and message queuing. Therefore, you already have the answer: Use the Java Builder toolbox , which allows you to compile MATLAB programs as Java classes... at that point you have the full machinery of Java EE, and calling the MATLAB Java component is the same as calling any Java class.
How would I host the matlab code in the server and the java code at the same time?
Previous paragraph, with an addendum: You will need to instal MATLAB's MCR on the server, which is royalty free, i.e. you do not need MATLAB on the server. I answered a similar question in the context of .NET... but the process is completely analogous. See http://www.mathworks.com/matlabcentral/answers/26255-matlab-vs-visual-net
How would I write to the mysql using Matlab? This would be the current primary question that requires answering
I also answered that question in detail in another post. See http://www.mathworks.com/matlabcentral/answers/37595-how-can-i-read-database-from-database-row-by-row. In that solution, I explain how to access a MySQL database with .NET. The the Java equivalent is completely analogous, since you can create Java classess from within MATLAB, that is to say, create your database access program in Java, test it, and then port the class calling part to MATLAB (using full qualifiers for the class names)
I hope that helps. Good luck.
4 Comments
Walter Roberson
on 21 Jul 2018
You will probably have to find a different hosting system. (Unless they permit Linux executables, in which case you would compile for Linux)
Walter Roberson
on 24 Apr 2012
Have you considered using Mathworks' Java Builder product?
2 Comments
Walter Roberson
on 24 Apr 2012
My recollection is that Neural Networks are supported by Java Builder, both for design and for classification using existing networks. My (possibly faulty) memory is telling me that until recently, creating new networks was not allowed. I could be wrong about that.
I do know, though, that the graphical NN tools are not supported -- and as best I recall, the MATLAB license does not permit compiled applications to give access to those graphical tools.
Java Builder supports everything that MATLAB Compiler supports.
Calling a hosted MATLAB program could possibly be most easily done by using the MATLAB Automation server, but only if the web server is running on MS Windows. It would then be an ActiveX invocation. (I don't know how to do that in Java.)
Outside of MS Windows with ActiveX, you would have Java exec the appropriate process, using the -nodesktop flag, and using the -r flag to specify the expression to start executing.
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!