Matlab codes on VS code
40 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hey plain and simple. I am trying to use m codes on VS Code because I can't "afford" another Matlab now appreantly I found this thing called VS code but where I can see my m code but I cannot run the code. Some people are saying " add Matlab to you system's PATH". I don't know what that means? Does that mean I have to have matlab installed on my computer? And if so wouldn't that be defeating the purpose? Immediated help needed!
Thank you
1 Commento
Samuel Gray
il 4 Feb 2021
It means to add it to the PATH string in the Windows environment.
This is described here: https://www.mathworks.com/matlabcentral/answers/100603-how-can-i-compile-a-matlab-engine-application-using-microsoft-visual-studio-9-0-or-10-0
specifically you want to add
%MATLABROOT%\bin\win64 (for x64 compiles)
in as the first matlab reference in the Path string
and a set for the path in the environment (MATLABROOT=c:\program files\MATLAB\Rxxxxx)
...that points to that subdir. You can do that in one line in the path.
I got this working in VS2015, now (just for fun) I'm trying o get it to work in VS Code. VS 1.52.1
and Eclipse and Qt if possible, likewise mincw
would be nice if Matlab had a page up on this and calling Vs code from within Matlab w/o using the "cmd" functio but it's nice to have something that actually works up on the site
Risposte (1)
Walter Roberson
il 3 Mar 2020
There are two MATLAB toolboxes that can compile (most) MATLAB code to an executable. When the executable is run, a copy of the internal MATLAB engine is started up that can run the code almost exactly the same as if you were running interactively. When either of the two toolboxes is used, the resulting executable is royalty-free and does not require that MATLAB itself be installed in order to run the program, but does require that a (free) copy of the MATLAB run-time library be installed on the user machine.
The executables produced by the above two toolboxes can only be used to run exactly what was programmed into them, not general MATLAB programs. For example if you developed a MATLAB program to (say) detect comets, then you would be able to use VS to call over to the pre-written program in order to detect comets, but you would not be able to do new work such as (say) draw a Snoopy calendar (not unless that was also programmed in to the executable.) The licenses on the two toolboxes require do not permit them to be used for general calculations, only for pre-programmed tasks.
You would not be able to access the MATLAB code using these toolboxes (other than as plain text files that no longer have a connection to what is running.) In particular, without MATLAB itself and a copy of the toolboxes, you would not be able to modify the MATLAB code and run the new code.
The two toolboxes I mention are both moderately expensive, around $US5000 each.
There is also a MATLAB toolbox that can take a subset of MATLAB and generate C or C++ code from it, which you can then incorporate into projects or compile as desired. This might involve calling into mathematical libraries (such as to do fft), but does not involve a MATLAB run-time library. When this toolbox is used, the resulting code is royalty-free and does not require that MATLAB itself be installed on the user system, and does not require that the MATLAB run-time be installed on the user system.
The code produced by this third toolbox can only be used to run exactly what was programmed into it, not general MATLAB programs. Not much is provided in the way of graphics: this toolbox is intended for using MATLAB as a prototyping language and then generating efficient code to be used as library functions. The licence on this toolbox also does not permit it to be used for general calculations, only for pre-programmed tasks.
You would not be able to access the MATLAB code using this third toolbox (other than as plain text files that no longer have a connection to what is running.) In particular, without MATLAB itself and a copy of the toolbox, you would not be able to modify the MATLAB code and run the new code.
This third toolbox I mention is fairly expensive, about $US9000.
If you want to be able to call out from VS to MATLAB to use MATLAB as a computational engine for whatever is asked to be done (as opposed to executing routines you have pre-programmed and used one of the expensive toolboxes to compile), then you need a MATLAB license and need to install MATLAB on the machine. (Though with careful programming, you just might be able to access a licensed copy of MATLAB installed on a server.) Only if you have a MATLAB license and MATLAB installed would you have the possibility of seeing the MATLAB code and modifying it and running the new code.
0 Commenti
Vedere anche
Categorie
Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!