[scilab-Users] Re: reading file in hexadecimal

Loïc GIROD Loic.Girod at esstin.uhp-nancy.fr
Tue Feb 8 18:12:01 CET 2011


Hello Mike, 

 

In fact, I’m trying to make a script to draw curves of a DSC scan (transformation temperatures in metal alloys).

We use a SETARAM DSC scan but the very old printer attached is nearly death.

Attached you will find a file describing the process to understand the values (sorry, it is in French).

So, I’m trying to make a script under scilab to read the files and make the curves.

The solution you gave me works well, but I’m not able to get more than 1000 floats in the file (I don’t know how to check the number of floats in the file).

 

If the way the file is coded is well-known, can I read directly the values instead of calculating it with the method exposes in the attached document ?

 

Many thanks

 

 

Loïc

 

 

 

De : Mike Page [mailto:Mike at Page-One.Waitrose.com] 
Envoyé : mardi 8 février 2011 17:56
À : users at lists.scilab.org
Objet : RE: [scilab-Users] Re: reading file in hexadecimal

 

Hi Loic,

 

Thinking about it, you might need to use an unsigned format ('ul') if any of your values are negative - dec2hex only works for positive numbers.  Anyway, you can try various things now you have a partial solution.

 

Mike.

 

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

Hello Mike, 

 

Many thanks for your answer.

It works perfect with a = dec2hex (mget (1, ‘l’, fd)).

I only need to read one float each time.

 

Thank you again

 

Loic

 

 

 

Subject: Re: reading file in hexadecimal 

From: "Mike Page" ####@####.#### 

Date: 8 Feb 2011 10:54:36 +0100 

Message-Id: <LKECIGCCKNOMMCKAGNOAAEMDDDAA.Mike at Page-One.Waitrose.com> 

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 ####@####.####

  Sent: 08 February 2011 09:13

  To: ####@####.####

  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

 

 

 

 

 

  Loic

 

 

 

 

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20110208/f99d2204/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: description_format_fichier.pdf
Type: application/pdf
Size: 52841 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20110208/f99d2204/attachment.pdf>


More information about the users mailing list