Re: Running Octave through a WWW server

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: Running Octave through a WWW server

Ray Anderson-2
I don't think the question posed in the attached message has been answered
fully, so here is my input.

I am running an application similar to the one described in the original
question where I convert the binary output from an Hspice simulation run to a .mat file. Then I
read the .mat file into octave, perform some manipulation of the data matrices and output a .gif
file to be displayed on the users web browser.

I had the same problem as described by the author of the original message:
It worked fine when executed from the command line but produced no gif
file when executed via the web interface.

In my case I found that there was no path information for octave to find
gnuplot when the cgi script was calling it. The solution was to add a line
to the cgi script to explicity set a path to the gnuplot binary before
invoking octave. Everything works as intended after that fix.


Ray Anderson

[hidden email]

------------- Begin Forwarded Message -------------

Resent-Date: Thu, 20 Nov 1997 13:56:19 -0600
X-Sender: [hidden email]
Date: Thu, 20 Nov 1997 13:52:11 -0600
To: [hidden email]
From: "W. Jarrett Campbell" <[hidden email]>
Subject: Running Octave through a WWW server
Mime-Version: 1.0
Resent-Message-ID: <"T7yFwNdVWoI.A.v1G.jXJd0">
Resent-From: [hidden email]
X-Mailing-List: <[hidden email]>
X-Loop: [hidden email]
Resent-Sender: [hidden email]

I just signed up to this list so please forgive me if a similar item has
been discussed before.  I'm currently working on a project that works as

1. Submit parameter values over a WWW form
2. a PERL/CGI script parses the data, opens OCTAVE and pipes in the data
3. OCTAVE opens an m-file, uses the data and lsode to solve some diff. eqs.
4. OCTAVE output a plot as a pbm file using gnuplot
5. ppmtogif is used to convert the pbm to gif format
6. The output is displayed in a web browser.

I successfully have done this using MATLAB/GNUPLOT but I am having some
difficulty with the OCTAVE implementation.

When I run the cgi script from the unix command line, everything works
fine.  But when I call the cgi from the web browser, my pbm and gif files
have file size 0 (zero).  I expect it has something to do with permissions,
but can't solve the mystery.  Yes, the output directories have 777
permissions (like I said, it works with MATLAB).

Here's a list of commands being sent to OCTAVE through the pipe:

             set term pbm
             set output "$output_ppm"
             cd $mfiles

where $XX are previously defined perl variabless and pilot is my m-file

global A2 A1 A0 B0 B1 B2 B3 K w

function xdot2=f2(x,t)
  global A2 A1 A0 B0 B1 B2 B3 K w

function xdot1=f1(x,t)
  global A2 A1 A0 B0 B1 B2 B3 K w

if A2 == 0
     taut = 10*A1/A0;
     x = lsode("f1", [0], (t = linspace (0, taut, 200)'));
     y = x;
     taut = 10*sqrt(A2);
     x = lsode("f2", [0; 0], (t = linspace (0, taut, 200)'));
     y = x(:,1);

set title "Dynamic Response"
set xlabel "Time"
set ylabel "Output"
set border
set nogrid
set nokey

Also, when just using GNUPLOT, I can use the size property to scale the
image.  But in OCTAVE, size has another meaning.  Is there some way to
scale the output?

Any help would be greatly appreciated.

Jarrett Campbell
[hidden email]

------------- End Forwarded Message -------------