Use PetscBinaryWrite.m from MATLAB (documentation at the top of the file) to 
save the array into a file then in PETSc use VecLoad() to load the matrix.  
PetscBinaryWrite.m is in $PETSC_DIR/bin/matlab or $PETSC_DIR/share/petsc/matlab 
depending on your version of PETSc.

   Barry



> On Jan 27, 2015, at 1:52 AM, siddhesh godbole <[email protected]> 
> wrote:
> 
> Hello,
> i am trying to import an array of 10000 elements into petsc. interfacing 
> fails when i try to use launch('./mycode',np,opt) in my matlab due to some 
> incompatibility. Then i tried importing .mat file into petsc and i got stuck.
> Can you please tell me how can i import an array from matlab into petsc and 
> use it for my calculations?
>  Thanks in advance!
> 
> Siddhesh M Godbole
> 
> 5th year Dual Degree,
> Civil Eng & Applied Mech.
> IIT Madras

Reply via email to