Run Matlab code from Javascript

99 vues (au cours des 30 derniers jours)
Frédéric Girod
Frédéric Girod le 31 Mar 2017
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 commentaire
Jan
Jan le 23 Juin 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.

Connectez-vous pour commenter.

Réponses (2)

Nhan Nguyen
Nhan Nguyen le 23 Juin 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 commentaire
Jan
Jan le 23 Juin 2017
Does this mean that you offer your Matlab and Ansys license to be used for free? Is this covered by the license agreements?

Connectez-vous pour commenter.


James Taylor
James Taylor le 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.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by