Actual source code: ex12.m

petsc-3.4.5 2014-06-29
  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.
  9: %  Make sure that ${PETSC_DIR}/bin/matlab is in your Matlab PATH.
 10: %
 11: if (nargin < 1)
 12:   np = 1;
 13: end
 14: if (nargin < 2)
 15:   opt = ' ';
 16: end
 17: time = 20;
 18: launch(['./ex12 -time ' int2str(time)  opt],np);

 20: p = PetscOpenSocket;
 21: for i=1:time,
 22:   v = PetscBinaryRead(p);
 23:   plot(v);
 24:   pause(1);
 25: end;
 26: close(p);