f



Calling matlab from java - matlab "Busy"

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<Double> f = new MatlabFunction<Double>("times");
		
		double x = f.execute(10,20);
		//System.out.println("x is " + x);
	}
}


My environment is:
 
matlab 7.1.0.246 (R14) Service Pack 3
Windows XP



Can anybody help?


Regards


John Seers
0
1/17/2006 2:55:25 PM
comp.soft-sys.matlab 211266 articles. 18 followers. lunamoonmoon (258) is leader. Post Follow

2 Replies
587 Views

Similar Articles

[PageSpeed] 50

John Seers wrote:
> 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<Double> f = new MatlabFunction<Double>("times");
> 		
> 		double x = f.execute(10,20);
> 		//System.out.println("x is " + x);
> 	}
> }
> 
> 
> My environment is:
>  
> matlab 7.1.0.246 (R14) Service Pack 3
> Windows XP
> 
> 
> 
> Can anybody help?
> 
> 
> Regards
> 
> 
> John Seers

Bad Bad Bad  :)

You can't call Java from Matlab to call back into Matlab. Matlab is busy 
waiting for the function to return and so the call into Matlab gets 
queued but never occurs. Classic deadlock situation. Don't even try to 
solve the problem. It is not possible. Matlab is single threaded and 
until Mathworks decides otherwise this is what happens. Calling Matlab 
from Java should only be done in the context of an action whose source 
is a Java thread. Things like button presses on Java GUI's and the like.

Regards

Brad

--
http://xtargets.com
0
bradphelan1 (255)
1/17/2006 7:29:46 PM
I have now got this working thanks to help from Brad Phelan.

Final code for the test example:


public class TestMat {
	
	
	public static void main() {
		class CallMatlab extends Thread {
			public void run() {
				MatlabFunction<double[]> f = new MatlabFunction<double[]>("times");		
				double[] x =   f.execute(10,20);
				System.out.println(x[0]);	
			}
		}
		CallMatlab c = new CallMatlab();
		c.start();
	}
}
0
1/23/2006 4:12:51 PM
Reply:

Similar Artilces:

Urgent JAVA Requirement in """"""NEW YORK"""""""""
Hello Partners, How are you ? Please find the requirement below. Location : NY Duration : 8 mnths Rate :Open Job description: Java/J2EE Web Service Developer =B7 (4+ years of application development experience in Java/J2EE and Web service technologies. =B7 Experience with spring & Hibernate. =B7 Experience with J2EE Application Server (preferably Web logic). =B7 Preferable Aqua logic DSP Experience =B7 Preferable Sonic ESB Composite Service experience Experience working in UNIX environment. Good working knowledge of Oracle RDBMS and PL/SQL) Note : Please send your updated resume along with contact no to Karthik@bhaninfo.com. Thanks & Regards Karthik BhanInfo karthik@bhaninfo.com # 1572, 7 th Floor Suites, 1 Blue Hill Plaza Pearl River,NY-10965 www.bhaninfo.com ...

about "++" and "--"
why this program snippet display "8,7,7,8,-7,-8" the program is: main() { int i=8; printf("%d\n%d\n%d\n%d\n%d\n%d\n",++i,--i,i++,i--,-i++,-i--); } > why this program snippet display "8,7,7,8,-7,-8" Ask your compiler-vendor because this result is IMHO implementation-defined. Check this out: http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.15 http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.16 Regards, Irina Marudina fxc123@gmail.com wrote: > why this program snippet display "8,7,7,8,-7,-8&q...

why "::", not "."
Why does the method of modules use a dot, and the constants a double colon? e.g. Math::PI and Math.cos -- Posted via http://www.ruby-forum.com/. On Oct 26, 2010, at 01:48 , Oleg Igor wrote: > Why does the method of modules use a dot, and the constants a double > colon? > e.g. > Math::PI and Math.cos For the same reason why inner-classes/modules use double colon, because = they're constants and that's how you look up via constant namespace. Math::PI and ActiveRecord::Base are the same type of lookup... it is = just that Base is a module and PI is a float....

"out" and "in out"
Hi i found the following explaination: In Ada, "in" parameters are similar to C++ const parameters. They are effectively read-only within the scope of the called subprogram. Ada "in out" parameters have a reliable initial value (that passed in from the calling subprogram) and may be modified within the scope of the called procedure. Ada "out" parameters have no reliable initial value, but are expected to be assigned a value within the called procedure. What does "have no reliable initial value" mean when considering the "out" parameter? By c...

Urgent need """""""""""INFORMATICA DEVELOPER"""""""""""""
Hello Partners, How are you ? Please find the requirements below. Title: Database/ETL Developer Duration: 6 months Location: NY Exp: 7+ Locals preferred Database/ETL requirements (Mandatory) Candidate must have worked with financial instruments, preferably Mutual Funds but, Equities are also ok. PL/SQL - packages, Stored procs, Functions, Aggregate functions, Pipelined Functions Informatica 8.6 - especially complex mappings, complex maplets, complex workflows, transformations Oracle 10g/11g Unix/Linux shell scripting Database/ETL requirements (Optional) Data warehousing experience Threading and job concepts in 10g/11g Cost based Optimizer concepts in 10g/11g Must : Experience with XML files and partitioning concepts in Oracle, Collections, Material Views Note : No phone calls please. : send Resumes to karthik@bhaninfo.com Thanks & Regards Karthik BhanInfo karthik@bhaninfo.com ...

"In" "Out" and "Trash"
I just bought a new computer and I re-installed Eudora Light on my new computer. But when I open Eudora, the "In", "Out" and "Trash" links are not on the left side of the screen the way they were on my old computer. How can I get these links back on the left side of the screen? Thank you. On 25 Mar 2007 09:49:22 -0700, "abx" <abfunex@yahoo.com> wrote: >I just bought a new computer and I re-installed Eudora Light on my new >computer. But when I open Eudora, the "In", "Out" and "Trash" links >are ...

"java -jar" vs "java -cp" question
I have my classes with the main method in main.jar, and an external library in external.jar. Now, I can start my application with: java -cp main.jar:external.jar MainClass Fine, but the following command does *not* work: java -cp external.jar -jar main.jar MainClass It doesn't find the classes in external.jar. Why not?? Thanks! Markus Hi Markus Here is the statement about -jar option in the java docs -jar Executes a program encapsulated in a JAR archive. The first argument is the name of a JAR file instead of a startup class name. In order...

"Stacks" should be called "Piles"
LOL! This is one pissed off Mactard!!! http://www.davidillig.com/whatamess.shtml ""Piles" Might be a Better Name "Stacks" are the worst idea I have ever seen in a GUI. The ability to place a folder in the Dock and right-click to see its contents in an easy-to-read, alphabetized list was powerful. I can no longer do that. See this abomination at <http://www.davidillig.com/whatamess.shtml>. Display as a grid, you say. Marginally better. I still can't hold the right button and see the contents of sub-folders. If Apple stole "Stacks" from Microsoft they must have gotten it out of the dumpster. It's not even good enough for Windows. Davoud" This guys is SOOOOOO out of the Church of Jobs. Jim and Alan might hunt him down and lynch him for heresy!!! "MuahMan" <muahman@cumcast.net> wrote in message news:DoCdnXH3rv61bLXanZ2dnUVZ_hKdnZ2d@comcast.com... > LOL! > > This is one pissed off Mactard!!! > > http://www.davidillig.com/whatamess.shtml > > ""Piles" Might be a Better Name > > "Stacks" are the worst idea I have ever seen in a GUI. The ability to > place a folder in the Dock and right-click to see its contents in an > easy-to-read, alphabetized list was powerful. I can no longer do that. > > See this abomination at <http://www.davidillig.com/whatamess.shtml>. > Display as a grid, you say. Marginally better. I still can't hol...

In HTML spec,are "href" and "style" called "attribute"?....@@
regards: <a href="JavaScript:loadwindow(106,90);" style="font-family:Verdana;">&#20803;&#26234;Intranet</a> In HTML spec,are "href" and "style" called "attribute"?....@@ Could someone good give me the hand? @@. thank you may god be with you On 29 Jan 2005 10:14:38 -0800, mike <s917124@mail.yzu.edu.tw> wrote: > regards: > > <a href="JavaScript:loadwindow(106,90);" > style="font-family:Verdana;">&#20803;&#26234;Intranet</a> > > In HTML spec,...

Gary Sokolich """"""
"""""""""" http://www.manta.com/c/mmlq5dm/w-gary-sokolich W Gary Sokolich 801 Kings Road Newport Beach, CA 92663-5715 (949) 650-5379 http://www.tbpe.state.tx.us/da/da022808.htm TEXAS BOARD OF PROFESSIONAL ENGINEERS February 28, 2008 Board Meeting Disciplinary Actions W. Gary Sokolich , Newport Beach, California �V File B-29812 - It was alleged that Dr. Sokolich unlawfully offered or attempted to practice engineering in Texas (...) Dr. Sokolich chose to end the proceedings by signing a Consent Order that was accepted by ...

Question about "sprintf" "@" "do for"
Hello, this works: A1=3D1 A2=3D2 A3=3D3 i=3D1 vari=3Dsprintf("A%.f",i) print vari,"=3D",@vari i=3Di+1 vari=3Dsprintf("A%.f",i) print vari,"=3D",@vari i=3Di+1 vari=3Dsprintf("A%.f",i) print vari,"=3D",@vari do for [i=3D1:3]{ vari=3Dsprintf("A%.f",i) print vari } But I want to have "print vari,"=3D",@vari" in the loop. But it dosen't=20 work. Why can't I use "print vari,"=3D",@vari" in the loop? Is there a=20 solution for? J=C3=B6rg Jörg ...

puts "\\".gsub("\\", "\\\\")
Hello, I have a mini-ruby quiz. Guess what this line of code writes to the console, then try it for yourself: puts "\\".gsub("\\", "\\\\") Why is that so? Martin From: martinus [mailto:martin.ankerl@gmail.com]=20 # Hello, I have a mini-ruby quiz. Guess what this line of code writes to # the console, then try it for yourself: # puts "\\".gsub("\\", "\\\\") puts "\\".gsub("\\", "\\\\") \ #=3D> nil # Why is that so? faq. escaping the escape in sub/gsub. search the archives. maybe you want somethin...

what does the "+" and the "-" mean?
I recently read what the "+" and the "-" signs mean for compact discs. Of course, a friend has just asked me and I now forget. I've searched all over the place with no results. Anyone know? TIA! .. -------------------------------------- Mike Richter, were you born with "Scam Artist" emblazoned on your face? -------------------------------------- roscoe james wrote: > > I recently read what the "+" and the "-" signs mean for compact discs. Of > course, a friend h...

how to change "/" to "\"
iam new to shell scripting and i have plz can anyone help in changing the pattrern "/" to "\" using the sed command. olympie@gmail.com wrote: > iam new to shell scripting and i have plz can anyone help in changing > the pattrern "/" to "\" using the sed command. sed 's/\//\\/g' will replace all '/' with '\' srp -- http://saju.net.in Saju Pillai <saju.pillai@gmail.com> wrote: >> iam new to shell scripting and i have plz can anyone help in changing >> the pattrern "/" to "\" using ...

why have both "." and "->" ?
I used to remember why c++ needed both ? Could somebody help me here ? For example class A{ f(); }; A* aa; You could do either "aa->f()" or "(*aa).f()". So why does C++ need both operators. Raj "raj" <rajkumar@hotmail.com> schreef in bericht news:d7fee6d0.0406230748.694b966b@posting.google.com... > I used to remember why c++ needed both ? > Could somebody help me here ? > > For example > > class A{ > f(); > }; > > A* aa; > > You could do either "aa->f()" or "(*aa).f()". So why does C++...

"==" is NOT TRUE "==", WHY?
[CODE START] x=5; y=8; if (x + y + 1E-15 == 13) a = 3 else a = 8 end [CODE END] When x + y + 1E-15, the code above returns a = 8. When x + y + 1E-16, the code above returns a = 3. Why? Kindly advise. Thanks. "onemilimeter Chen" <onemm@example.com> wrote in message <g7adrj$5tr$1@fred.mathworks.com>... > [CODE START] > x=5; > y=8; > if (x + y + 1E-15 == 13) > a = 3 > else > a = 8 > end > [CODE END] > > When x + y + 1E-15, the code above returns a = 8. > When x + y + 1E-16, the code above returns a = 3. > > Why? ...

"Java slooow" or "programmers sloppyyyyy" ?
Now, granted, I am a beginner on the Java platform. Dived into it last year and so far I really like what I've seen. I'm not a programmer myself but mostly a system administrator, but because I wanted to grasp something a little more recent than Pascal (on Linux/Solaris you really have no benefit with Pascal) and because C / Perl didn't really appeal to me I ended up here. I can't help wonder if a lot of the "Java is slow" comments I hear around me aren't fed by the results of sloppy programmers. For example.. I read that you should make a very good jud...

Re: "out" and "in out"
"no reliable initial value" means, you cannot rely on the value, but it may have a value. This depends on the parameter passing mechanism, which is _not_ related to the parameter mode (contrary to what many people think). So the parameter mode is there (nearly) solely for the information of the reader. The parameter passing mechanism for all kinds of parameters is defined in the RM. There are parameters passed by copy (in and out), by reference; for some it is explicitly left undefined. In your case, the passing mechanism is by reference, so you get what you get. But don't rely...

"A" is not equal "A"?
I was trying to convert String Array to String A through cycle and than compare the result with String B but eventhough results were the same it returned false. I'am working in BlueJ 3.1.0 Code is: public boolean Method () { String[] Example = {"a","b","c"}; String A = ""; String B = "abc" for (int i = 0; i<3 ; i++) { A = A + Example[i]; } if (A == B) { return true; } } never got true... I appreciate any suggestions how to solve this Den 08.04.2014 10:06, skrev 245dav@gmail.com:...

iOS7 called "ugly" "inconsistent"
So, a "NEW BIG THING" that falls on it's flat on it's face. iSteve must be rolling over in his jar. http://finance.yahoo.com/news/professional-designers-call-apples-iphone-144003657.html Apple's new operating system for iPhones and iPads, iOS 7, is a complete redesign over what you're used to using. The change is so huge, in fact, that Apple calls it its biggest update to the iPhone software since the original iPhone launched in 2007. There's no doubt about that. But a lot of professional designers aren't as enthusiastic about the iOS 7's new look. Since Apple's announcement yesterday, designers have called iOS 7 everything from "inconsistent" to just plain "ugly." There's even a Tumblr blog full of iOS 7 design complaints. Here's a look at what designers are saying: Sorry to say but iOS 7 design is the ugliest ever. — pod2g (@pod2g) June 10, 2013 1. Helvetica sucks for OS2. Helvetica Light sucks more3. Helvetica Light & tight übersucks.#ios7 — erik spiekermann (@espiekermann) June 11, 2013 Sorry, Jonathan Ive, I loved your work, but you've created crap. #ios7 I feel betrayed. :-) — Serg Metelin (@sergmetelin) June 11, 2013 The entire UI insists upon itself, and the color palette is far too pedantic.This "interface" is simply unusable. #iOS7 #wwdc — Paul Fort (@work_paul) June 11, 2013 They gave one different icon for each Junior...

"stanford university" "stanford business school" "stanford mba" "stanford video lectures" "stanford law school" "stanford cs" "stanford university history" "stanford medical school" ON http: #3
"stanford university" "stanford business school" "stanford mba" "stanford video lectures" "stanford law school" "stanford cs" "stanford university history" "stanford medical school" ON http://stanford-edu.blogspot.com/ "stanford university" "stanford business school" "stanford mba" "stanford video lectures" "stanford law school" "stanford cs" "stanford university history" "stanford medical school" ON http://...

How can I pass "-verbosegc" to a java application which is launched by "Java Web Start"
I have a JAVA Application, which is launched by "Java Web Start". Now I want to get Information about Gabage Collction. Normally in JAVA I just set the JVM-option "-verbosegc" to activate logging. But How can I pass that option to my JVM through "Java Web Start". Is there any to set tis option whitin my ".jnlp" File ??? Thanks for any help Willi ...

"Artists' representative", "Rumblefish", calls bird songs "copyrighted music"
http://yro.slashdot.org/story/12/02/26/2141246/youtube-identifies-birdsong-as-copyrighted-music YouTube Identifies Birdsong As Copyrighted Music |from the estate-of-john-cage-winces-with-envy dept. NB John Cage made a recording called 4'33 which was four and a half minutes of silence. |eeplox writes "I make nature videos for my YouTube channel, |generally in remote wilderness away from any possible |source of music. And I purposely avoid using a soundtrack |in my videos because of all the horror stories I hear |about Rumblefish filing claims against public domain music. | |But when uploading my latest video, YouTube informed me |that I was using Rumblefish's copyrighted content, |and so ads would be placed on my video, |with the proceeds going to said company. This baffled me. |I disputed their claim with YouTube's system |--and Rumblefish refuted my dispute, and asserted that: |"All content owners have reviewed your video |and confirmed their claims to some or all of its content: |Entity: rumblefish; Content Type: Musical Composition." | |So I asked some questions, and it appears that |the birds singing in the background of my video |are Rumblefish's exclusive intellectual property. A comment from an employee peatbakke wrote: (#39168473) |there have been a lot of shitty plays in the copyright world |[...]But ... that's not what we do. :) Yeah, right, dude. ACTIONS speak louder than words. |Rumblefish works specifically for ind...

Is there any """Anti Stringizing operator #"""
Hi everybody:D I've a string that contains the name of a class. Some members told that I can use """Stringizing Operator (#)""", but the problem is here, that I have the string, & I want something vice- versa. As we know with """Stringizing Operator (#)""", we can get the stirng name of a class or ... str <--- #ClassA But I want to instantiate a class that I have just it's name as a string. ClassA * clsA = new ??? <--- Str ??? How can I do it? I don't want to use """HardCoding"&qu...

"plot", "imshow" and "quiver"
Hi all. So recently I made the discovery that when use "imshow" command, the YDir parameter under Axis Properties is set to "reverse" by default. To me this seems counter intuitive. Why wouldn't YDir be "normal" by default? When set at "normal" it turns out that my image is actually flipped upside down. On the contrary, when use "quiver" command to plot a vector field, the YDir is set at "normal" by default. Even though this makes more sense to me, because "reversed" YDir is the correct way to display an image (as in "imshow"), the result of "quiver" is that the vector fields this time depict the objects as if they are upside down... So every time I use "quiver" I always add the following line to revert the objects back to its normal orientation... set(gca, 'YDir', 'reverse')... In addition, "plot" uses "normal" setting for YDir. The only issue I have is that I use these commands fairly frequently in my job and sometimes they can get a little bit confusing in terms of display. So I wonder why MATLAB hasn't standardized them so that the objects always get displayed the same way. It's just a comment I have. Thank you. "Clare " <flyingclare@gmail.com> wrote in message news:hefvdk$3md$1@fred.mathworks.com... > Hi all. So recently I made the discovery that when use "imshow" command, > the ...

Web resources about - Calling matlab from java - matlab "Busy" - comp.soft-sys.matlab

Resources last updated: 3/20/2016 7:24:32 PM