Actual source code: ex12.m

petsc-3.5.4 2015-05-23
Report Typos and Errors
  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}/share/petsc/matlab and ${PETSC_DIR}/${PETSC_ARCH}/lib/matlab.
  9: %  Make sure that ${PETSC_DIR}/share/petsc/matlab and ${PETSC_DIR}/${PETSC_ARCH}/lib/matlab is in your MATLABPATH or
 10: %  $prefix/share/petsc/matlab and $prefix/lib/matlab if you ran ./configure with --prefix
 11: %
 12: if (nargin < 1)
 13:   np = 1;
 14: end
 15: if (nargin < 2)
 16:   opt = ' ';
 17: end
 18: time = 20;
 19: launch(['./ex12 -time ' int2str(time)  opt],np);

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