There is no return value for bin/matlab/PetscReadBinaryMatlab.m?
Barry Smith
bsmith at mcs.anl.gov
Mon Aug 3 15:21:00 CDT 2009
Do you have the latest PETSc 3.0.0 with all its patches?
On Aug 3, 2009, at 3:16 PM, (Rebecca) Xuefei YUAN wrote:
> I used PetscBinaryRead('solution') before, but it kept returning the
> error message:
> --------------------------------------------------------------
>>> c = PetscBinaryRead('solution');
> ??? Undefined function or method 'freader' for input arguments of
> type 'char'.
>
> Error in ==> PetscBinaryRead at 22
> fd = freader(inarg);
> -------------------------------------------------------------
> The Petsc function I use to save this binary file is
> PetscViewerBinaryOpen().
>
> Since that is not successful, I started on my own...
>
> Cheers,
>
> R
>
>
> Quoting Barry Smith <bsmith at mcs.anl.gov>:
>
>>
>> Use bin/matlab/PetscBinaryRead.m with
>>
>> c = PetscBinaryRead('solution');
>>
>> The help for PetscBinaryRead.m indicates other uses also, for
>> example, if you put multiple PETSc objects into the same viewer.
>>
>> Barry
>>
>> On Aug 3, 2009, at 2:51 PM, (Rebecca) Xuefei YUAN wrote:
>>
>>> Dear Barry,
>>>
>>> I might not state the problem clearly, I saved my solution to a
>>> binary file named "solution", so after running the code, there
>>> two files "solution" and "solution.info" were formed. Then I
>>> would like to the following matlab function to load the data:
>>>
>>> fid = fopen('solution','r');
>>> c = fread(fid);
>>>
>>> What I would like to have for c is a 1d Array with 36
>>> elements(real number), however, it turns out that c is a 1d array
>>> has 1116 elements(integer), what is wrong with it? Do I miss
>>> anything? Or the binary file from Petsc is different from the
>>> normal binary file?
>>>
>>> Thanks very much!
>>>
>>> R
>>>
>>> Quoting Barry Smith <bsmith at mcs.anl.gov>:
>>>
>>>>
>>>> I use PetscBinaryRead.m then call the plot routines directly in
>>>> Matlab.
>>>>
>>>> You can also use the PetscReadBinaryMatlab() stuff to put the
>>>> contour
>>>> commands directly in the .info file and then use
>>>> PetscReadBinaryMatlab.m
>>>>
>>>> Barry
>>>>
>>>>
>>>> You can use PetscReadBinary
>>>> On Aug 3, 2009, at 1:32 PM, (Rebecca) Xuefei YUAN wrote:
>>>>
>>>>> Dear Barry,
>>>>>
>>>>> Thanks very much! If this is the case, do you have any
>>>>> suggestions to load the binary file into matlab thus doing the
>>>>> output, like contour(u)?
>>>>>
>>>>> Thanks!
>>>>>
>>>>> R
>>>>>
>>>>> Quoting Barry Smith <bsmith at mcs.anl.gov>:
>>>>>
>>>>>>
>>>>>> Thanks for reporting this. The documentation for this Matlab
>>>>>> function is wrong, it doesn't actually return anything.
>>>>>>
>>>>>> I have fixed the docs and it will be fixed in the next patch.
>>>>>>
>>>>>> Barry
>>>>>>
>>>>>> On Aug 3, 2009, at 8:04 AM, (Rebecca) Xuefei YUAN wrote:
>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> --
>>>>>>> (Rebecca) Xuefei YUAN
>>>>>>> Department of Applied Physics and Applied Mathematics
>>>>>>> Columbia University
>>>>>>> Tel:917-399-8032
>>>>>>> www.columbia.edu/~xy2102
>>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> (Rebecca) Xuefei YUAN
>>>>> Department of Applied Physics and Applied Mathematics
>>>>> Columbia University
>>>>> Tel:917-399-8032
>>>>> www.columbia.edu/~xy2102
>>>>>
>>>
>>>
>>>
>>> --
>>> (Rebecca) Xuefei YUAN
>>> Department of Applied Physics and Applied Mathematics
>>> Columbia University
>>> Tel:917-399-8032
>>> www.columbia.edu/~xy2102
>>>
>
>
>
> --
> (Rebecca) Xuefei YUAN
> Department of Applied Physics and Applied Mathematics
> Columbia University
> Tel:917-399-8032
> www.columbia.edu/~xy2102
>
More information about the petsc-users
mailing list