Combining Matlab & [removed] Methods of integratio

2019-03-31 14:14发布

I have a MatLab script that I would like to use in my Javascript algorithm. Is there any way of getting JavaScript to call a MatLab script? Better yet, is there any way to loosely couple a MatLab script and a Javascript page?

I found this one page that discussed using .NET server to hold the MatLab script/code (http://www.mathworks.com/matlabcentral/answers/9521), but are there any other easier methods to get this working?

I would much rather not have to re-code the MatLab in JavaScript. Ideally, I would like to use my JavaScript as it currently works to spit a string of a specified format into a MatLab script directly and access its string output after that algorithm is done.

What are the ways in which I can do this? If there is only the .NET or similar approach, does anyone have good resources to guide how to do this carefully or even better, personal experience with how to set this up?

Thank you in advance.

Revisit NOTE (Dec 17, 2013) & Decision Made: It turns out that in the end it proved easier to just re-code my MatLab script into JavaScript. Google Closure was released for JavaScript a while ago, and it provides a beautiful bit of extended functionality to the JavaScript language, and I highly recommend it to anyone interested in using it. I particularly made use of its Matrix library, which allowed me to re-code & design my Nodal Voltage Analysis method in JavaScript. Check it out: https://developers.google.com/closure/

2条回答
混吃等死
2楼-- · 2019-03-31 15:02

For deployment matlab will always need to be run on server side mostly via java or .net. However you can use javascript and matlab inside matlabs browser. Its not very pretty and makes use of the matlab: command. A tutorial is given here and the bellow code executes the why script.

<a href=”matlab:why”>Why?</a>
查看更多
Emotional °昔
3楼-- · 2019-03-31 15:03

From the 16B version there is a way to talk to MATLAB from JavaScript using MPS and RESTFUL. Here is am example link http://www.mathworks.com/help/mps/restfuljson/example-web-based-bond-pricing-tool-using-javascript.html

查看更多
登录 后发表回答