On Thu, May 27, 2010 at 12:23 PM, Mike Hansen <[email protected]> wrote: > On Thu, May 27, 2010 at 12:20 PM, Vinod <[email protected]> wrote: >> The simple matlab code I wrote is functional and the sage server >> evaluates it properly and generates the .png file in the directory. >> Only issue that need to be addressed is to get the sage server display >> the plots in the web browser itself. We are planning to provide this >> to a set of students who take summer classes and >> it would be really great if we can get this working. >> >> rightnow, this creates the nicefig2.png file in the directory home/ >> sageserver/matlab/user/ >> >> Is it something to do with the directory it writes? > > Yes. In order for this to work, someone needs to implement the chdir > method for the Matlab interface. See the example in > sage/interfaces/mathematica.py >
In the meantime, try this:
import os
filename = os.path.join(os.path.abspath('.'),'matlabfig1.png')
matlab.eval("h = figure('Visible', 'off')")
matlab.eval("plot(1:.1:10, sin(1:.1:10))")
out = matlab.eval("saveas(h,'%s')"%filename)
See screenshot for proof this works...
--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
<<attachment: Screen shot 2010-05-27 at 2.04.31 PM.png>>
