Class ml: Method toString
// Convert MatLab real to String.
private String toStringReal(double x)
{
if ( (x - Math.floor(x)) == 0 )
return (int)x + "";
else
return x + "";
}
// Convert MatLab complex value to String.
public String toString()
{
if ( im == 0 )
return toStringReal(re);
else
return toStringReal(re) + " + " +
toStringReal(im) + "i";
}
Previous slide
Next slide
Back to first slide
View graphic version