[scilab-Users] reading file in hexadecimal

Mike Page Mike at Page-One.Waitrose.com
Tue Feb 8 10:54:36 CET 2011


Hi Loic,

Not sure what you want exactly, but the file looks like a set of floats
(4-byte IEEE 754 floating point values).  You can read these using:

a = mget (n, 'f', fd)

where n is the number you want to read and fd is the file descriptor (you
get that using fd=mopen("F1_31.dat",'rb').

If you really want the values in hex, then it depends on how many bytes per
hex value.  If there are 4 bytes each, then you can use something like:

a = dec2hex (mget (n, 'l', fd))

Hope that helps.

Mike.

  -----Original Message-----
  From: Loïc GIROD [mailto:Loic.Girod at esstin.uhp-nancy.fr]
  Sent: 08 February 2011 09:13
  To: users at lists.scilab.org
  Subject: [scilab-Users] reading file in hexadecimal


  Hello,



  Beginner under scilab, I’m trying to make a script to read a file and make
some calculations on the data.

  I would like to read the file attached (F1_31) as an hexa format.

  For the moment, I use notepad++ to convert the file in hexadecimal and I
can read it in scilab using mopen/mfscanf.



  I would like to be able to read the file directly under scilab, without
using another software.



  Is it possible ?



  If yes, could you please explain me the procedure ?



  Best regards





  Loïc





  --

  Loïc GIROD, Ph.D.

  Ingénieur
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  ESSTIN, LEMTA, LPMM
  2 rue Jean Lamour
  54500 VANDOEUVRE LES NANCY
  FRANCE
  Tel. : +33 3 83 68 51 44
  Port. : +33 6 82 07 98 52
  Email. : loic.girod at esstin.uhp-nancy.fr


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20110208/7fad4508/attachment.htm>


More information about the users mailing list