Actual source code: ex12.m

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

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