Always always always check the return codes for each call (you can<br>use the CHKERRQ macro). Otherwise, you have no idea whether an<br>error occurred during the call.<br><br>&nbsp; Matt<br><br><div class="gmail_quote">On Mon, Feb 16, 2009 at 7:05 PM, Yixun Liu <span dir="ltr">&lt;<a href="mailto:enjoywm@cs.wm.edu">enjoywm@cs.wm.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
I want to output matrix and vector into matlab.<br>
// output a vector,<br>
 &nbsp; &nbsp; &nbsp;PetscViewer bviewer;<br>
 &nbsp; &nbsp; &nbsp;PetscViewerCreate(PETSC_COMM_WORLD, &amp;bviewer);<br>
 &nbsp; &nbsp; &nbsp;PetscViewerSetType(bviewer, PETSC_VIEWER_ASCII);<br>
 &nbsp; &nbsp; &nbsp;PetscViewerSetFormat(bviewer, PETSC_VIEWER_ASCII_MATLAB);<br>
 &nbsp; &nbsp; &nbsp;PetscViewerFileSetName(bviewer, bname);<br>
 &nbsp; &nbsp; &nbsp;VecView(externalForcesVector, bviewer);//externalForcesVector is a<br>
parallel vector.<br>
<br>
However, the output file contains nothing.<br>
<br>
Thanks.<br>
<font color="#888888"><br>
Yixun<br>
<br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>