Actual source code: ex12.m

  1: function ex12(np,opt)
  2: %
  3: % From Matlab run  ex12(np)
  4: %
  5: % ex12.c 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}/share/petsc/matlab and ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab
 10: %  to create these run ./configure --with-matlab
 11: %
 12: %  Make sure that ${PETSC_DIR}/share/petsc/matlab and ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab is in your MATLABPATH or
 13: %  $prefix/share/petsc/matlab and $prefix/lib/petsc/matlab if you ran ./configure with --prefix
 14: %
 15: if (nargin < 1)
 16:   np = 1;
 17: end
 18: if (nargin < 2)
 19:   opt = ' ';
 20: end
 21: time = 20;
 22: launch(['./ex12 -time ' int2str(time)  opt],np);

 24: p = PetscOpenSocket;
 25: for i=1:time,
 26:   v = PetscBinaryRead(p);
 27:   plot(v);
 28:   pause(1);
 29: end;
 30: close(p);