xref: /petsc/src/vec/vec/tutorials/ex42.m (revision 896ba80d1e9092a2cde96fd78fb9ec213220a562)
1function ex42(np,opt)
2%
3%  ex42(np,opt) - launches ./ex42 and runs a loop 1000 times sending and then receiving a one dimensional array via a Unix socket to it
4%
5%  Run with option -on_error_attach_debugger to debug
6%
7%  Requires PETSc be configured with --with-matlab
8%
9%  MATLABPATH must contain
10%     ${PETSC_DIR}/share/petsc/matlab and ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab
11%
12if (nargin < 1)
13  np = 1;
14end
15if (nargin < 2)
16  opt = ' ';
17end
18launch('./ex42  ',np,opt);
19
20socket=PetscOpenSocket;
21delta=zeros(512,1);
22
23for i=1:1000
24  PetscBinaryWrite(socket,delta);
25  delta = PetscBinaryRead(socket);
26end
27pause(0.1);
28
29close(socket);
30
31