how I can transform syms to String in java?
Show older comments
Im trying to make a calculator (for school) where i can integrate, derivative and graph an equation. But when matlab have to return the answer, i get a Exception, i was looking around until i found that matlab turn the answer to "syms" (54*x - 4 for example). So i try to get like an object then turning into string but all i got is " [Ljava.lang.Object;@4b9385". It is there anyway that i can get the syms and turning into a string?
Answers (1)
Walter Roberson
on 18 Sep 2015
char() the syms object. For example,
syms x
result = diff(sin(x) - cosh(x),x);
result_string = char(result);
2 Comments
Oscar Gutierrez
on 18 Sep 2015
Walter Roberson
on 18 Sep 2015
It appears that you are using http://matlabcontrol.googlecode.com/svn-history/r503/javadocs/doc/matlabcontrol/MatlabOperations.html
If I understand the examples, then
Object[] d = proxy.returningeval("char( int(9*x^3 - 2*x^2,2,x) )", 1);
System.out.println("Result: " + d[0]);
This is consistent with the "returning feval" example at https://code.google.com/p/matlabcontrol/wiki/Walkthrough which is a case that returns a string.
Categories
Find more on Common Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!