Actual source code: ex12.m

  1: function ex12(np,opt)
  2: % $Id: ex12.m,v 1.8 2001/03/22 20:32:50 bsmith Exp $
  3: %
  4: %   ex12(np)
  5: % creates a series of vectors in PETSc and displays them in Matlab
  6: %
  7: % Run with option -on_error_attach_debugger to debug
  8: %
  9: %  Requires the Matlab mex routines in ${PETSC_DIR}/bin/matlab. To make
 10: % these cd to ${PETSC_DIR}/src/sys/src/viewer/impls/socket/matlab and run make BOPT=g matlabcodes
 11: % then make sure that ${PETSC_DIR}/bin/matlab is in your Matlab PATH.
 12: %
 13: if (nargin < 1)
 14:   np = 1;
 15: end
 16: if (nargin < 2)
 17:   opt = ' ';
 18: end
 19: time = 20;
 20: err = launch(['ex12 -time ' int2str(time) ' -viewer_socket_machine ' getenv('HOST') opt],np);
 21: if (err ~= 0) then
 22:   return;
 23: end

 25: p = openport;
 26: for i=1:time,
 27:   v = receive(p);
 28:   plot(v);
 29:   pause(1);
 30: end;
 31: closeport(p);