<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:m =
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.2800.1649" name=GENERATOR>
<STYLE>@font-face {
font-family: Calibri;
}
@font-face {
font-family: Tahoma;
}
@page WordSection1 {size: 612.0pt 792.0pt; margin: 70.85pt 70.85pt 70.85pt 70.85pt; }
P.MsoNormal {
FONT-SIZE: 11pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"; mso-fareast-language: EN-US
}
LI.MsoNormal {
FONT-SIZE: 11pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"; mso-fareast-language: EN-US
}
DIV.MsoNormal {
FONT-SIZE: 11pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"; mso-fareast-language: EN-US
}
A:link {
COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
P.MsoAcetate {
FONT-SIZE: 8pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Tahoma","sans-serif"; mso-fareast-language: EN-US; mso-style-priority: 99; mso-style-link: "Texte de bulles Car"
}
LI.MsoAcetate {
FONT-SIZE: 8pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Tahoma","sans-serif"; mso-fareast-language: EN-US; mso-style-priority: 99; mso-style-link: "Texte de bulles Car"
}
DIV.MsoAcetate {
FONT-SIZE: 8pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Tahoma","sans-serif"; mso-fareast-language: EN-US; mso-style-priority: 99; mso-style-link: "Texte de bulles Car"
}
SPAN.TextedebullesCar {
FONT-FAMILY: "Tahoma","sans-serif"; mso-style-priority: 99; mso-style-link: "Texte de bulles"; mso-style-name: "Texte de bulles Car"
}
SPAN.EmailStyle19 {
COLOR: windowtext; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal
}
SPAN.EmailStyle20 {
COLOR: #1f497d; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal-reply
}
.MsoChpDefault {
FONT-SIZE: 10pt; mso-style-type: export-only
}
DIV.WordSection1 {
page: WordSection1
}
</STYLE>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=FR vLink=purple link=blue>
<DIV><SPAN class=765482517-08022011><FONT face=Arial color=#0000ff size=2>Hi
Loic,</FONT></SPAN></DIV>
<DIV><SPAN class=765482517-08022011><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=765482517-08022011><FONT face=Arial color=#0000ff size=2>You
can find the size of a file using fileinfo:</FONT></SPAN></DIV>
<DIV><SPAN class=765482517-08022011><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=765482517-08022011><FONT face=Arial color=#0000ff size=2>info =
fileinfo("F1_31.dat");</FONT></SPAN></DIV>
<DIV><SPAN class=765482517-08022011><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=765482517-08022011><FONT face=Arial color=#0000ff size=2>This
returns a vector - the first element info(1) is the file size in bytes. As
an IEEE float is 4 bytes, divide by 4 to get the number of values in the
file. For the example you provided, this seems to be 3065
values.</FONT></SPAN></DIV>
<DIV><SPAN class=765482517-08022011><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=765482517-08022011><FONT face=Arial color=#0000ff size=2>Since
the values are IEEE float format and little-endian, you can read them directly
using:</FONT></SPAN></DIV>
<DIV><SPAN class=765482517-08022011><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=765482517-08022011><FONT face=Arial color=#0000ff size=2>a =
mget (3065, 'f', fd);</FONT></SPAN></DIV>
<DIV><SPAN class=765482517-08022011><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=765482517-08022011><FONT face=Arial color=#0000ff size=2>Hope
that helps.</FONT></SPAN></DIV>
<DIV><SPAN class=765482517-08022011><FONT face=Arial color=#0000ff
size=2>Mike.</FONT></SPAN></DIV>
<DIV><SPAN class=765482517-08022011><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=765482517-08022011><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=765482517-08022011><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Loïc GIROD
[mailto:Loic.Girod@esstin.uhp-nancy.fr]<BR><B>Sent:</B> 08 February 2011
17:12<BR><B>To:</B> users@lists.scilab.org<BR><B>Subject:</B> RE:
[scilab-Users] Re: reading file in hexadecimal<BR><BR></FONT></DIV>
<DIV class=WordSection1>
<P class=MsoNormal><SPAN style="COLOR: #1f497d">Hello Mike,
<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN style="COLOR: #1f497d"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="COLOR: #1f497d">In fact, I’m trying
to make a script to draw curves of a DSC scan (transformation temperatures in
metal alloys).<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="COLOR: #1f497d">We use a SETARAM
DSC scan but the very old printer attached is nearly
death.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="COLOR: #1f497d">Attached you will
find a file describing the process to understand the values (sorry, it is in
French).<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="COLOR: #1f497d">So, I’m trying to
make a script under scilab to read the files and make the
curves.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="COLOR: #1f497d">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).<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="COLOR: #1f497d"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="COLOR: #1f497d">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 ?<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="COLOR: #1f497d"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="COLOR: #1f497d">Many
thanks<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="COLOR: #1f497d"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="COLOR: #1f497d"><o:p> </o:p></SPAN></P>
<DIV>
<P class=MsoNormal><SPAN lang=EN-US
style="COLOR: #1f497d; mso-fareast-language: FR">Loïc<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="COLOR: #1f497d; mso-fareast-language: FR"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="COLOR: #1f497d; mso-fareast-language: FR"><o:p> </o:p></SPAN></P></DIV>
<P class=MsoNormal><SPAN style="COLOR: #1f497d"><o:p> </o:p></SPAN></P>
<DIV>
<DIV
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: #b5c4df 1pt solid; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
<P class=MsoNormal><B><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'; mso-fareast-language: FR">De :</SPAN></B><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'; mso-fareast-language: FR">
Mike Page [mailto:Mike@Page-One.Waitrose.com] <BR><B>Envoyé :</B> mardi 8
février 2011 17:56<BR><B>À :</B>
users@lists.scilab.org<BR><B>Objet :</B> RE: [scilab-Users] Re: reading
file in hexadecimal<o:p></o:p></SPAN></P></DIV></DIV>
<P class=MsoNormal><o:p> </o:p></P>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-language: FR">Hi
Loic,</SPAN><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-language: FR"><o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-language: FR"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-language: FR">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.</SPAN><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-language: FR"><o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-language: FR"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-language: FR">Mike.</SPAN><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-language: FR"><o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-language: FR"> <o:p></o:p></SPAN></P></DIV>
<BLOCKQUOTE style="MARGIN-TOP: 5pt; MARGIN-BOTTOM: 5pt; MARGIN-RIGHT: 0cm">
<P class=MsoNormal style="MARGIN-BOTTOM: 12pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'; mso-fareast-language: FR">-----Original
Message-----<BR><B>From:</B> Loïc GIROD
[mailto:Loic.Girod@esstin.uhp-nancy.fr]<BR><B>Sent:</B> 08 February 2011
16:24<BR><B>To:</B> users@lists.scilab.org<BR><B>Subject:</B> [scilab-Users]
Re: reading file in hexadecimal</SPAN><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-language: FR"><o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>Hello Mike, <o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>Many thanks for your
answer.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>It works perfect with a = dec2hex (mget
(1, ‘l’, fd)).<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>I only need to read one float each
time.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>Thank you again<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>Loic<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>Subject: Re: reading file in hexadecimal
<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>From: "Mike Page" ####@####.####
<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>Date: 8 Feb 2011 10:54:36 +0100
<o:p></o:p></SPAN></P>
<P class=MsoNormal>Message-Id:
<LKECIGCCKNOMMCKAGNOAAEMDDDAA.Mike@Page-One.Waitrose.com>
<o:p></o:p></P>
<P class=MsoNormal>Hi Loic,<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal><SPAN lang=EN-US>Not sure what you want exactly, but the
file looks like a set of floats<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>(4-byte IEEE 754 floating point
values). You can read these using:<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>a = mget (n, 'f',
fd)<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>where n is the number you want to read
and fd is the file descriptor (you<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>get that using
fd=mopen("F1_31.dat",'rb').<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>If you really want the values in hex,
then it depends on how many bytes per<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>hex value. If there are 4 bytes
each, then you can use something like:<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>a = dec2hex (mget (n, 'l',
fd))<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>Hope that helps.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>Mike.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US> -----Original
Message-----<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US> From: Lo</SPAN><SPAN
style="FONT-FAMILY: 'Tahoma','sans-serif'">�</SPAN><SPAN lang=EN-US>c GIROD
####@####.####<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US> Sent: 08 February 2011
09:13<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US> To:
####@####.####<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US> Subject: [scilab-Users] reading
file in hexadecimal<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US> Hello,<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US> Beginner under scilab,
I</SPAN><SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'">�</SPAN><SPAN
lang=EN-US>m trying to make a script to read a file and
make<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>some calculations on the
data.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US> I would like to read the file
attached (F1_31) as an hexa format.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US> For the moment, I use notepad++
to convert the file in hexadecimal and I<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>can read it in scilab using
mopen/mfscanf.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US> I would like to be able to read
the file directly under scilab, without<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>using another
software.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US> Is it possible
?<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US> If yes, could you please explain
me the procedure ?<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US> Best
regards<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US> Lo</SPAN><SPAN
style="FONT-FAMILY: 'Tahoma','sans-serif'">ic</SPAN><SPAN
lang=EN-US><o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="mso-fareast-language: FR"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="mso-fareast-language: FR"><o:p> </o:p></SPAN></P>
<P
class=MsoNormal><o:p> </o:p></P></BLOCKQUOTE></DIV></BLOCKQUOTE></BODY></HTML>