[Numpy-discussion] Matlab_NumPy_Array?

Greg Ball gball at cfa.harvard.edu
Wed Aug 22 18:04:09 CDT 2001


Try replacing step 4 with

A_string=fromstring(read_file, 'd')

'f' is for 32 bit floats, 'd' is for 64 bit floats.
Matlab uses 64 bit (double) floats.

HTH

--Greg Ball



On Sun, 19 Aug 2001, Karshi Hasanov wrote:

> 
> Hi all,
> 
>  I  don't understand how to conver arrays from Matlab to Numpy. Here what I 
> did: 1) Converted Matlab A(i,j,k) to 'A.dat' binary file
>       2) file_open=open('~/A.dat', 'rb')
>       3) read_file=file_open.read()
>       4) A_string=fromstring(read_file, 'f')
>       5) A=reshape(A_string, (i,j,k))
> where i,j,k are size of A[i,j,k]
> 
> I am not getting the right. 
> What is the best/right way of convering arrays?
> Thanks
> 
> 
> 
> 





More information about the Numpy-discussion mailing list