<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>students@work &#187; matlab</title>
	<atom:link href="http://www.stupent.at/tag/matlab/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stupent.at</link>
	<description>Antworten auf die die Menschheit gewartet hat!  -- Heisenberg war hier ... oder auch nicht!</description>
	<lastBuildDate>Tue, 17 Aug 2010 13:51:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Accessing Matlab from Java</title>
		<link>http://www.stupent.at/2009/04/15/accessing-matlab-from-java/</link>
		<comments>http://www.stupent.at/2009/04/15/accessing-matlab-from-java/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 11:42:44 +0000</pubDate>
		<dc:creator>Cici</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[matlab]]></category>

		<guid isPermaLink="false">http://www.stupent.at/2009/04/15/accessing-matlab-from-java/</guid>
		<description><![CDATA[Today i had to access a matlab script from a java program. After some hours of trying to get it work by using matlabs command line i found a method to call a matlab script without using the command line. Using matlab -r &#8220;functionName&#8221; didn&#8217;t work because of some unknown charset erros i haven&#8217;t found [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stupent.at%2F2009%2F04%2F15%2Faccessing-matlab-from-java%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stupent.at%2F2009%2F04%2F15%2Faccessing-matlab-from-java%2F" height="61" width="51" /></a></div><p>Today i had to access a matlab script from a java program. After some hours of trying to get it work by using matlabs command line i found a method to call a matlab script without using the command line. Using matlab -r &#8220;functionName&#8221; didn&#8217;t work because of some unknown charset erros i haven&#8217;t found till now. The basic idea is based on this <a href="http://shatterednirvana.wordpress.com/2007/07/12/howto-call-matlab-from-java-kinda/">blog-post</a>.</p>
<p>Therefore, a process must be created:</p>
<p><code><br />
String command = "matlab -nosplash -nodesktop";<br />
Process process = Runtime.getRuntime().exec(command);<br />
</code></p>
<p>Afterwards we obtain the standard-input of the process and send a command to be interpreted by matlab:</p>
<p><code><br />
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(process.getOutputStream()));<br />
out.write("function_to_be_executed");<br />
out.write("\n");<br />
out.write("exit;") // this will close matlab after the execution finished!<br />
</code></p>
<p>If you like to see what is happening, try to read from the process.getInputStream()</p>
<p>hope that helps some of you!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stupent.at/2009/04/15/accessing-matlab-from-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
