Prev: Manova theory & calculations?
Next: Creating a spline from a list of points and calculating the tangents to it
From: Grant on 10 Mar 2010 11:55 Can anyone tell me how to call a Java class main method, that takes in a command line input string, from Matlab. My simple class looks something like this: public class Calculate_square public static void main (String[] args){ int input, output; input=args[0]; output=input*input; System.out.println(output); } } I call this class from the terminal like this: $java Calculate_square 4 Thank you
From: Yair Altman on 11 Mar 2010 02:14
"Grant " <grant.clark(a)mcgill.ca> wrote in message <hn8itp$b2j$1(a)fred.mathworks.com>... > Can anyone tell me how to call a Java class main method, that takes in a command line input string, from Matlab. My simple class looks something like this: > > public class Calculate_square > public static void main (String[] args){ > int input, output; > input=args[0]; > output=input*input; > System.out.println(output); > } > } > > I call this class from the terminal like this: > > $java Calculate_square 4 > > Thank you did you try to simply call Calculate_square.main(...) from the Matlab command prompt? Note that your class, as-is, will not work - you need to convert from String to int before you can multiply... Yair Altman http://UndocumentedMatlab.com |