f



Calling Matlab from Java #2

I have skimmed the Klimke article, which looks quite good, on calling
Matlab from Java.  However, I think it is based on the assumption that
the Matlab engine will be available.  I want to work with compiled
Matlab codes that can run independently of a Matlab installation.

Compiling a standalone executable and calling it from Java's Runtime
is easy enough, but as Klimke said, it relies on intermediate files or
text streams to communicate.  So you can't pass your data structures
right through.  

With JNI and C wrappers, you should be able to.  I got as far as
getting a shared library (a .dll for Windows) built that exports the
right hooks for java.  I was able to call the code from Java but it
trips an exception somewhere in the Matlab boilerplate.  With some
additional work this might eventually be gotten to work.  The staff in
tech support tell me that even if this works, anyway Matlab graphics
will very likely be unavailable.  And as far as the whole JNI/wrapper
idea, it's beyond the range of what they currently support.

Hope this info helps somebody.

0
tsprott (1)
10/14/2003 1:15:08 AM
comp.soft-sys.matlab 211266 articles. 15 followers. lunamoonmoon (258) is leader. Post Follow

0 Replies
584 Views

Similar Articles

[PageSpeed] 11

Reply:

Similar Artilces:

matlab in JAVA or java in MATLAB? #2
Hi guys I am now experencing a great difficulty in the interation between java and matlab. I have an objective function written in JAVA with has method return an numerical number, i call it 'profit'. The nature of this obtive function (ObjFun.java) is that it takes an parameter input, say C, with different C value, the returned profit value is different. Eventually I want to find the optimized C value which produce the maximun profit (C will be under constrains). Initially I want to use linprog or fminsearch in matlab. So I tried the command in matlab that excutes my ObjFun.ja...

Get a result from Matlab to Java (Call Matlab from JAVA
Hi all, I am having trouble getting the return value from matlab to JAVA. I have tried Kamin Whitehouse 's code(matlabcontrol.java) and get working for eval and feval, but having trouble using blockingFeval function which returnts the value of matlab. The problem I am having is it returns some value valid only in matlab workspace and when I play around with the return value in matlab, it works fine but in Java program it is just junk data. I corresponded with Kamin and he thinks that jmi.jar has been changed since he developed the class. The matlab library now returns the handle of t...

matlab in JAVA or java in MATLAB?
Hi guys I am now experencing a great difficulty in the interation between java and matlab. I have an objective function written in JAVA with has method return an numerical number, i call it 'profit'. The nature of this obtive function (ObjFun.java) is that it takes an parameter input, say C, with different C value, the returned profit value is different. Eventually I want to find the optimized C value which produce the maximun profit (C will be under constrains). Initially I want to use linprog or fminsearch in matlab. So I tried the command in matlab that excutes my ObjFun.java. But it failed because my ObjFun.java will call an external .exe file. and the file path contains spaces which is fine by Java but not matlab. I stuck here, I myself is a Java programmer not good at matlab, I can't find any thing on google about the solution to my problem. So here I propose another idea: call matlab function in JAVA. I need some advise on this. Thank you very much for a reply!!! Lemon can anyone give advice?? "Lemon F" <f.lemon.jin@hotmail.com> wrote in message <i3bag7$i96$1@fred.mathworks.com>... > can anyone give advice?? If you would not have double-posted you would have seen that you already received advice (on the other post): http://www.mathworks.com/matlabcentral/newsreader/view_thread/288403 ...

Calling matlab from java (windows), and running the java code not using the matlab JVM
Hello, I want to know if there is a way to call matlab from java (in windows), but not by calling the java code from matlab. I want to use a different JVM than the one matlab uses. In linux it is simple since I can use input/output redirection, is there a way to do this in windows (I have matlab 5.3, pretty old version). Thanks a lot, Nili. ...

Java Jar Files and Matlab need to call my SAX parser from java in matlab
All, I have a java SAX parser that I want to call from matlab. I did the research and figured out how to load the jar containing the class in matlab. Problem is I called my file and apparrently the matlab version doesn't support the SAX parser and/or the JDBC drivers I use to interact with a database. Is there another way to do this other than loading the class into matlab which obviously failed. Would I be able to call the jar somehow with a system command? Thanx Ryan ...

Call a Matlab function from Java running in matlab.
Hi guys. I really apologize for asking this question, since I'm sure it is either basic or not possible, but I have been reading through the documentation and can't seem to figure this out, since the examples look like they just send and receive variables from the Java methods. Could anyone give me a short example of how to call a method from a Java object that causes some sort of action to be performed in MATLAB? For example, I would like to: 1) make a new object of MyClass from MATLAB called MyObject. 2) run MyObject.DoSomethingInMatlab() 3) have a statement in DoSomethingInMatlab...

Eclipse RCP and MATLAB (calling MATLAB from JAVA)
Dear all I need some help about using Eclipse RCP with MATLAB. I want receive input variables from web (probably using Eclipse RCP, I just heard about Eclipse RCP) and calcuate something and generate figure or animation in MATLAB. Finally, send the result to the web and display them using Eclipse RCP. I know about MATLAB Web Server (MWS). However, MWS has some limitation, so I want to combine Eclipse RCP with MATLAB for more compatibility. Could you help me ? The example will be greate help for me. Thanks in advance. ...

Call Java from Matlab #2
I'm working with Matlab R2006b on Windows. I 'm intesresting by the NetCDF Java package to access to data files for read and write. I've found some examples, I try on Matlab, in the document : NetCDF Java Users' Manuel (page 33-34). I need some help to call some classes of the librairy nc2.2.jar, particulary for writing files : all the classes type ArrayInt (Double, ...) for dimensions D1, D2, D3 .... I success to manage dimension, attribut, but I don't manage to create a array of data for any dimension I know. In Matlab, the instruction : ucar.ma2.ArrayInt.D3(2, latDim.g...

matlab beginner: calling matlab from C/C++ #2
I'm relatively new to the world of Matlab. I want to call my matlab own code from a C/C++ program on a machine with matlab installed. Do I need to compile the matlab code using matlab compiler tool or the matlab engine is enough for this? Thanks a lot for your help ...

Calling matlab from java
Hello All I am trying to call Matlab from java. I am using Brad Phelan's matlab snippet http://xtargets.com/snippets/user/bradphelan/tag/feval to investigate how to do this but all I get is matlab showing "Busy" and basically hanging. I have tried commenting out the semaphore control which "helps" but I then get a null exception because the return value is null. I call my test routine from matlab as follows: TestMat.main({}) My test routine looks like Brad's example: public class TestMat { public static void main(String[] args) { MatlabFunction&l...

problems calling java in matlab #2
Hi, I have a problem with calling Java from matlab, I'm using version 6 of matlab which is running version 1.1.8 of java. I wrote a simple class to use in a program of mine, just once class, not part of a package or anything, and I add the directory of where it is into classpath.txt, then restart matlab. However, I can still not create an instance of the class, even when I try and create it two different ways: >> PauseClass(1) ??? Undefined function or variable 'PauseClass'. javaObject('PauseClass', 1) ??? Error using ==> javaObject No class PauseClass can be lo...

Calling java class from matlab #2
Hello all, I need to call java class from m file. I included the javapath in classpath.txt, when i run the m file i get an error msg. ??? Error using ==> javaObjectEDT No class Main.class can be located on Java class path Error in ==> primary_pat4 at 313 javaObjectEDT('Main.class'); Can anybody help me to solve this problem. Niratha The javaObjectEDT function expect a class name, not the filename. If you did not have a fully qualified class name like : com.mycompany.project.Main, you probably can use 'Main' instead of 'Main.class'...

Call C code from Matlab -> Matlab crash #2
Hello, I have a problem calling C code from Matlab. The mex file compilation is ok. When I run the program Matlab (7.3) crashes. Below is the mexFunction code. Any idea is welcome. (I think the main part of the code (middle part) is not useful for the crash problem, but I put it anyway). //########################################################### #include "math.h" #include "mex.h" void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { // Standard variables int p,r,h,i,j,f,w; // Indices for loop int MAX_NBM = 1000; int MAX_DIM = 10; in...

Calling Matlab in C in Matlab
Hi everybody! My problem can be described as follows. I have a tool in Matlab that requires calling an optimisation algorithm in C. This algorithm consists of several C-files, one of which contains the function to be minimised (CFUNCTION), and another is the main algorithm file (CMAIN). Now what I want to do is to call Matlab from CFUNCTION or CMAIN and specify my custom function (MFUNCTION) to be minimised. So, I'm calling Matlab from C from Matlab. I'm a newbie in C and MEX files. Should I rewrite CMAIN as a MEX file and include CFUNCTION in this and then use mxCallMATLAB? Or can...

Calling Compiled MATLAB from MATLAB
Hello everyone, How do I compile MATLAB M files into a form that can then be called from within the MATLAB interpreter? A roundabout way would seem to be to (somehow) Turn the matlab code into C (I think mcc does this), then compile this C code into MEX format and call that. Is there an easier way? I have the MATLAB compiler, so I just need to know what to do with it to get this to work. Thanks in advance, Sina sina.tootoonian wrote: > > > Hello everyone, > > How do I compile MATLAB M files into a form that can then be called > from within the MATLAB interpreter? A roundabout way would seem to > be > to (somehow) Turn the matlab code into C (I think mcc does this), > then > compile this C code into MEX format and call that. Is there an > easier > way? I have the MATLAB compiler, so I just need to know what to do > with > it to get this to work. > > Thanks in advance, > > Sina > > HELP MEX > HELP MEX Or, better, HELP MCC help pcode pseudo code is useful to obfuscate code - protect algorithms, yet still run at full speed and be distributable to other matlab users sina.tootoonian wrote: > > > Hello everyone, > > How do I compile MATLAB M files into a form that can then be called > from within the MATLAB interpreter? A roundabout way would seem to > be > to (somehow) Turn the matlab code into C (I think mcc does this), > then > compile this C code into MEX format and call that...

JAR resource not found when calling Java from Matlab #2
Hi all I was trying to construct a Java object in Matlab after making Matlab aware of the JAR file containing the class using javaaddpath(). That works so far. However, the Java code wants to access a resource file that also resides in this JAR using ClassLoader.getSystemResourceAsStream(fileName). When running the JAR from the command line, this works well, but not if run within Matlab. After investigating a bit, I printed the runtime classpath when the JAR is called using System.getProperty("java.class.path"). Strangely, only Matlab JARs are listed in the runtime classpath, and t...

How to notify Matlab about Java object change in Matlab Java Interface?
Hello, Does anybody has any idea how to update Matlab function about Java object change ? It could be done by polling: while JavaObj.getValue()=='not done yet' pause(1); end But polling is evil. There should be more elegant way to do this job ... I've checked 'Matlab Java Interface' docs : http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/f6671.html , but found nothing on the subject :( Thanks in advance for your help, Could you use javacomponent to set up the object, and set a callback to repond to the changed value? On Apr 21, 5:44=A0pm, &...

matlab calling DLL vs. .exe calling matlab engine
Hello, I'm writing an 3D image recognition which sends commands via RS232 to a Robot which moves to the point in 3D. The problem is the serial interface: sending string commands via serial/fprintf is very slow (I really don't know what matlab makes before sending them) in comparison to e.g. Windows hyperterminal. My question is if it is better to execute a dll out of Matlab-code doing the serial things or viceversus writing a program in c++ which uses the matlab-engine ? What could be the fastest way? What are advantages/disadvantages ? Any help would be appreciated. Thanks in advanc...

How to call matlab functions directly from C++ /without calling matlab engine
How to call matlab functions directly from C++ without calling matlab engine. as it is described in this tutorial: http://www.codeproject.com/samples/matlab_cpp.asp I have tried to do something similar in Visual Studio 2005 [Matlab 7, r14] #include <mclcppclass.h> .... mwArray A, B, C; A = magic(mwArray(5)); B = transpose(A); .... but it doesn't compile. I got following errors: error C3861: 'magic': identifier not found error C3861: 'transpose': identifier not found etc... I was looking for header files with declarations of this functions in matlab directory...

methods to call matlab in C C++ and call C C++ in matlab
Hi, I am reading the help documents about how to program matlab and C C++ together and my questions are a little bit general. It seems that are several ways to call matlab in C C++ and another several ways to call C C++ in matlab. Please correct me if I am wrong or missing something when I try to list them. To call matlab code in C C++, are there two methods available? The first one is Matlab engine and the second one is to use MATLAB Compiler mcc to create C or C++ shared libraries from your MATLAB code. To call C C++ in matlab, are there also two methods? The first one is to call funct...

calling Matlab w/o Matlab
Hi, is it possible to call simple matlab function or a compiled file w/o starting matlab? For example from a VBA code? I don�t mean excel link or creating Matlab as an object. It both require starting Matlab. Is there any way? Thank You You mean, other than buying the MATLAB Compiler, building a DLL, and calling the entry points directly? I don't think so. john. ondrej wrote: > > > Hi, > is it possible to call simple matlab function or a compiled file > w/o > starting matlab? For example from a VBA code? I don�t mean excel > link > or creating Matlab as an objec...

Matlab compiler for Matlab 5.2
I'm looking for matlab compiler for matlab 5.2 for Mac computers. I wasn't able to find anywhere because the Mathworks doesn't produce it. Do you know were I may find it? Thanks ...

can Matlab support 32-bit matlab version scripts on 64-bit version of matlab #2
can Matlab support 32-bit matlab version scripts on 64-bit version of matlab in windows platform?.if yes , how is the performance better ? please do answer this question thank u ...

Java in Matlab #2
The following file... <http://library.med.utah.edu/masspec/mongo.js> is a java script that performs some calculations that I would like to run in Matlab workspace. Does anyone know how can run Java scripts inside of Matlab? Any help will be greatly appreciated... Julio p.s. I tried url = java.net.URL('http://library.med.utah.edu/masspec/compo.js') with no luck :( Can anyone please give me an advice? ...

Web resources about - Calling Matlab from Java #2 - comp.soft-sys.matlab

Calling Dr. Death - Wikipedia, the free encyclopedia
Calling Dr. Death (1943) is the first of the Universal Pictures Inner Sanctum mystery films . The "Inner Sanctum" franchise originated with a ...

List of country calling codes - Wikipedia, the free encyclopedia
This is a list of country calling codes defined by ITU-T recommendations E.123 and E.164 , also called IDD ( International Direct Dialling ) ...

Messenger For Android Update Includes Free Calling For Canadian Users
... internet protocol) and voice features. This time, Facebook’s latest update to the Messenger application for Android includes free calling for ...

Facebook Video Calling - Facebook
Bring your conversations to life on Facebook. With face-to-face video calling, now you can watch your friends smile, wink and LOL. To get started, ...

Facebook’s Talktime program in India pays new mobile users in calling credit
... Facebook has launched its Talktime program in India which gives every new user who signs up with a mobile device 50 Rupees (almost $1) in calling ...

Berlin Calling (@neuraum) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Calling all foodies: Here comes @TwitterFood
There are many thousands of food-related Tweets people send on Twitter each day – Tweets about meals, ingredients, favorites, recipes and dining ...

Rounds Video Calling + Chat for iPhone 4, iPhone 4S, iPhone 5, iPhone 5c, iPhone 5s, iPad 2 Wi-Fi, iPad ...
Get Rounds Video Calling + Chat on the App Store. See screenshots and ratings, and read customer reviews.


Patent application could see the Apple Watch calling 911 when it detects a heart-attack
A patent application describes how the Apple Watch and iPhone could work together to detect medical emergencies like a heart attack, and automatically ...

Resources last updated: 3/10/2016 9:19:14 PM