Run Matlab code from Javascript
99 views (last 30 days)
Show older comments
Hi, I have my own website and would like to allow people (my website's visitors) to run little funny Matlab scripts or commands directly on my website. How can I run Matlab commands from Javascript ? Thanks. F.
1 Comment
Jan
on 23 Jun 2017
Does this mean, that vistors of your web site can run a Matlab function, which calls sendmail to distribute millions of spam mails? Or crash your server by for k = 1:1e5; c{k}=rand(1,1e5); end? A Matlab script could display the contents of your license file. I would not dare to offer such a service in public.
Answers (2)
Nhan Nguyen
on 23 Jun 2017
I'm looking for it too. Actually I also want to use the javascript to call matlab code while the matlab code calls ansys and abaqus analyses.
1 Comment
Jan
on 23 Jun 2017
Does this mean that you offer your Matlab and Ansys license to be used for free? Is this covered by the license agreements?
James Taylor
on 16 Sep 2021
For several options to run commands remotely from JS.
Matlab scripts may be run at the command line, using matlab as an interpreter. This is actually accomplished (somewhat) differently depending on your environment, My normal arrangement would use a #!matlab first line, executed in a bash shell.
License types vary, so your mileage may vary. Using your local matlab as a script engine to allow packaged program scripts to be executed seems within fair use, unless specifically forbidden, say by a single user license as opposed to a single machine license. The fair use would be similar to the current matlab compiler license that allows an executable to be distributed which includes the matlab engine.
All that said, as was discussed at that initial link, the suggested action, to execut a program or script remotely you must break the JS security model. Don't.
0 Comments
See Also
Categories
Find more on Web Services 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!