After we open a MATLAB IDE, are we still able to write to its command window from another process?
In Windows, we could use MATLAB Engine API to attach to an existing MATLAB, while this does not work in Linux/Mac.
Do we have any solutions in Linux?
If you want to connect from a separate java process, consider using MatlabControl. It allows you to easily launch new Matlab instance from java process and then communicate with it though JMI, i.e. java-to-matlab interface that is shipped with each Matlab release.
Is it also possible to connect to existing Matlab instance, but you will need to modify MatlabControl code to do that, and you will need to manually execute some command from within the Matlab instance you wish to connect to.
There is a nice series of articles on MatlabControl / JMI on Undocumented Matlab.
As of 2016b, there is also an official MATLAB Engine API for Java.
Related
Hello I am new to the Omnet++. I was trying to run the Omnet from the Matlab. Is it possible to run the particular project and generate results in Omnet++ using the Matlab or any command and without actually going on the graphical interface for pressing run button in Omnet++?
From what I have read in the official documentation site (https://omnetpp.org/), it is a library for discrete event simulation. The library is writeen in C++.
It is possible to compile and use C++ code and results using the Matlab MEX-API. (http://es.mathworks.com/help/matlab/call-mex-files-1.html). This API provides a fairly easy bidirectional connection interface between Matlab and C++. It enables matlab to create data to be further processed in C++ and the show the results on matlab later.
Hope it is useful for you!
The toolbox packaging functionality new in R2014b looks pretty nice.
However, you seem to be able to package a toolbox only via the toolbox-packaging GUI.
I'd like to be able to create a .prj file interactively using the GUI, and then programmatically package the toolbox using this .prj file, incorporating this programmatic step into a wider build process (which also includes checking things out, running a unit-test suite etc).
Does anyone know of a way to do this (documented or not, supported or not)?
I took a look at MATLAB\R2014b\toolbox\matlab\toolbox_packaging\+matlab\+tbxpkg\+internal\create.m - this seems to mostly do the job, but it requires that the .prj file is in a specific location relative to the toolbox folder.
I was hoping for something similar to the app-building classes such as matlab.apputil.
As of R2016a there is new functionality to programmatically package a toolbox.
I have created an excel addin using MATLAB builder EX (Release 2014a). However, the deployed application fails at runtime with the error that it could not find built-in toolbox functions such as ppmak, optimoptions etc. Functions that are part of standard MATLAB installation like mean, isnan etc work fine. Also, user defined functions and classes work fine. Could anyone share any insights on this issue?
I want to package up an application in MATLAB for another team to use. They will have an appropriate version of MATLAB to run this application, but they might not necessarily have licenses for all the toolboxes used by the application.
Is there a way to "bundle" the toolboxes into the application so that they do not require expensive licenses to run it?
If not, is it possible to create a stand-alone/license independent MATLAB application a different way?
EDIT: Some of these applications might feature GUIs as well as command line interfaces.
To generate code that can be run by MATLAB, you need the MATLAB Coder. The codegen command will generate the executables that can be run in MATLAB. Loren of MathWorks has a nice blog post on the product.
Here is an example of how to use codegen to create a MEX function from MATLAB code.
One big caveat is that with MATLAB Coder, the complete functionality of MATLAB is not yet available for compilation. This is because the generated binaries do not require the MATLAB Compiler Runtime (MCR), which is essentially a headless MATLAB virtual machine. Instead MATLAB Coder generates C code that is truly standalone, but the code generation is somewhat limited as a result. Here is a description of the subset of functionality, and here are complete lists of functions supported. Most toolkit functions appear to be supported according to the categorical list.
If the required functions are not supported, then it will be necessary to use the Compiler to generate standalone libraries and roll your own MEX interface to those libraries, as MrAzzaman indicated. Another possibilities is to use the loadlibrary function to directly load the Compiler-generate libraries, although I have never tried this last option. If you can't successfully interface with these libraries back in MATLAB, the MATLAB compiler can of course be used to generate a standalone executable. The deploytool simplifies the process of packaging the code and its dependencies.
The MATLAB Compiler sounds like exactly what you need. Unfortunately, it is a separate Toolbox which you would have to purchase.
EDIT: I should note that this will compile your MATLAB code into an application/library, not MATLAB code. The other team would still be able to use it with MATLAB, I believe, but I don't think they would be able to see the code itself.
Im sure there are a thousand different posts on Maple vs Matlab, but i have a bit of a unique set of requirements and before i go off to learn one of the two i would like to know which one will do it best.
I have a set of data from an accelerometer recording an impact. I need to do the following:
fit a curve to the data
Find the equation for that curve
solve the equation listed at the link
http://upload.wikimedia.org/wikipedia/en/math/2/d/3/2d39556df1dbbd467dc914253e93cdb0.png
which solves for a family of curves,i.e the MAX under the interval.
I would like to do this as seamlessly with visual studio as possible. The GUI and all the other elements of the app are built in VB and I would like to keep it there. I know maple has a code generating part to it that will convert to VB, would it be able to handle something like this? Does Matlab integrate with Visual Studio well? I would be thrilled if there was an object i could place on the VB form which would facilitate the communication to and from the matlab or maple framework. Currently i have it working with R, however to do so i need to write the data to a file, launch the R script, wait for it to finish, return control to my VB app and take it from there. This process takes too long and since i do not have experience with multi threaded programming the GUI freezes up when control is passed to the script.
Any help or suggestions would be very much appreciated!
In your case I would choose neither of the two. You may have a look at Python Tools for Visual Studio. The blog post mentions support for NumPy & SciPy for .Net which gives you all the math power you need at hand well integrated in the .Net world.
EDIT:
By looking at matplotlib's gallery I'm tempted to say that matplotlib is on par with MATLAB.
MATLAB doesn't auto-generate VB code, but it can easily be called from a VB application without the indirection of writing a file. It has COM interface that can be called directly from within VB code. See this example from the MATLAB documentation to find out more.
To carry out the technical analysis you've mentioned, you would probably save time by using Curve Fitting Toolbox in addition to base MATLAB.
Note that the above method of connecting to MATLAB via its COM interface relies on there being a live copy of MATLAB present when the VB application is executed. If you need to share your application with people who don't have a copy of MATLAB, you can also create standalone COM components and .NET assemblies from MATLAB code that can be called in the same way by your VB code, but can be deployed freely to people without a MATLAB license - however, this requires an extra product, MATLAB Builder for .NET.