Opening a .DAT file

11 views (last 30 days)
Jake
Jake on 6 Jul 2012
I need to open a .DAT file that was created in 1988. This .DAT file was created by Fortran, which was programmed to collect streaming data.
The first ten rows are a header and I believe that each and every row is 140 bytes.
I have tried several programs and I get garbage. When I tried Matlab, I get actual numbers, but no header (which probably means it is all garbage).
I am using the "fopen" and "fread" commands in matlab.
Can anyone give me some insight on how to open this file correctly?
I can send the file upon request.
PS - I am a fairly new user, so cut me some slack.
This is what I get when I open it with Notepad:
14ma30 pinsfx s20e25 w2c p vel v D € 14MA30PINSFX314:13 VAG” F²FRp РÐB Ø@ÃõÀ¶ó]AòÒ æ=ܟýÌgš;€P3>sªÁ;@Ú‘<àuk;P¦> v< ½%¾s‹ =¨Ð†¼`¾’¶½ÌO­¼àTŽ=mñ¾ˆèZ<Àb½í~¾ÐÝL½Àž85†<€({½P:“½ƒE">8¼ •=î‡>ˆ§s=P8>[²¼Àßf=5 €@ €@ €@ €@ €@ A A A A A A E € B ÈB E @ÞB  B B ðB 0=#lî>†p¿Ët±»J4s;Æa´;t@ÚÿͼԨ¬?ƪ1¿÷~9»mù°»´jO<hœ@˜ÿ®¼bL@/I¿ u¼l¯¼u«¨<Û@ºý>Aƒ@µKG¿õª;N€/¼°/È<mZ@|þ`=à­”@wî,¿÷ɼžÌ)¼Þ×-<®¨@Nþ0=‡pî>ip¿ t²»ù¬t;Bk³;“\@Øÿͼš‡¬?«1¿ýz'»ÎÀ®»c²Q<åÄ@˜ÿ­¼ô¸@~I¿tq¼gô°¼Ê*©< J@ºý>C¥ƒ@ýKG¿ñ£;½ê-¼ïvÆ<E@„þa=u”@™î,¿ññƼ ò(¼N.<ì{@Xþ0=étî>Lp¿ut´»x)u;*r²;Ô«@Øÿͼff¬?F«1¿w»Œ{¬»øS<í@–ÿ­¼ˆ%@ÍI¿Þn¼Lƒ°¼š®©<¸@¼ý>Cºƒ@ELG¿ í;ýO+¼§»Ã<Ûä@Žþa= ”@»î,¿Øìļ©&¼ÁQ/<ºP@`þ0=Myî>/p¿Jtµ»ý£v;·~±;¯ú@Øÿͼ=E¬?†«1¿s»L1«»{9V<¯@–ÿ¬¼4’@I¿Dk¼Q±¼û7ª<M @¼ý>?σ@ŒLG¿ é–;P¨)¼ øÁ<€ª@–þa=˜ÿ”@Ýî,¿ÃçÁ¼[?$¼ÏŽ0<Ð&@jþ0=°}î>p¿t·»òw;Jˆ±;™I@Øÿͼ'$¬?Æ«1¿ oẉ¦©»‡hX<NB@”ÿ«¼ÿ@gI¿ª g¼´Ä±¼ÚÁª<p~@¼ý>7äƒ@ÓLG¿å;Pú(¼J*¿<Ýo@ þb=%p”@ÿî,¿­â¾¼ge"¼•Ë0<Qú@tþ0=‚î>öo¿õs¸»‡–x;•°;Q˜@Øÿͼ,¬?¬1¿ k¼ºŸÂ§»š‰Z<p@”ÿ«¼Jl@±I¿ d¼Tt²¼çKª<vÌ@¾ý>$ùƒ@MG¿ûà‰;;&¼ZP½<5@¨þb=¬à”@#ï,¿•Ý»¼¼!¼ð1<DÍ@|þ0=w†î>Ùo¿Ésº»*y;嚯;jç@Øÿ̼Xâ¬?F¬1¿ g—º¡¥»?—\</¡@’ÿª¼ÌÙ@õI¿s a¼;.²¼mÒ«<e@¾ý>ƒ@bMG¿íÜ‚;r$¼Älº<m÷@²þc=/Q”@Dï,¿Ø¸¼ µ¼¤E2<8¢@†þ0=ÚŠî>»o¿žs»»‹z;(¥¯;6@Øÿ̼¸Á¬?‡¬1¿cdºñ~£»¾Ž^<UÖ@’ÿª¼·G@6I¿Ú]¼@î³¼«Q«<Ç"@Àý>Ü"ƒ@ªMG¿ÙØw;«/"¼<~¸<·@ºþc=ªÁ”@fï,¿gÓµ¼‰Ý¼‹‚3<¦v@Žþ0=?î>žo¿ss½»6{;l®®;(…@Øÿ̼J¡¬?ɬ1¿ý^ºò'¡»¡|a<R@ÿ©¼2¶@qI¿CZ¼ò²³¼ Ç«<Â%@Àý>£7ƒ@òMG¿½Ôi;Gd ¼ª„¶<¾v@Âþd=2”@‰ï,¿Qγ¼V¼F¾4< G@–þ0=£“î>o¿Gs¾»µ~|;·­;Ô@Øÿ̼ ¬? ­1¿òZš¹ñDŸ»dc<¢M@Žÿ©¼¸%@§I¿°W¼Gp´¼Ñ(«< @Âý>ZLƒ@8NG¿—Ð[;ú–¼Í‚´<2@Êþd=‡¢”@«ï,¿8É°¼¾-¼›ù5<@žþ0=˜î>co¿s¿»,û};æÀ­;Â"@Øÿ̼@a¬?P­1¿ÞV¶B»žJe<ÌŽ@Œÿ¨¼À–@ÛI¿$T¼!´¼…qª<Ã×@Æý>ÿ`ƒ@€NG¿jÌM;(½¼ÿz±<úæ@Ôþe=ë”@Íï,¿ Ä­¼±U¼Ý35<óë@¦þ0=kœî>Fo¿òrÁ»q~;Yͬ;¹r@Öÿ̼®A¬?–­1¿ÈR™9þ^›»Cg<M×@Šÿ¨¼˜ @ I¿žP¼¿´¼" ª<*‡@Èý>’uƒ@ÇNG¿3È?; â¼’o¯<Eš@Üþe=Bƒ”@ïï,¿¿ª¼K~¼ôm6<¾@®þ0=Рî>)o¿Ær»rï;Þ«;}Á@Öÿ̼c"¬?Þ­1¿­N:¹t™»wOj<¶#@ˆÿ§¼~@8I¿ M¼OA´¼û«ª<u@Ìý>Šƒ@OG¿óÃ2;ð¼ƒ_­<ÈI@äþe=ó”@ð,¿í¹§¼n§¼¡§7<AŽ@¶þ0=7¥î> o¿›rÄ»†i€;Fs«;@Öÿ̼\¬?'®1¿ŽJh:¢©—»Apl<¤x@†ÿ¦¼¢õ@dH¿®ÿI¼š´¼EŒ©<nš@Ðý>ˆžƒ@UOG¿«¿$;S¼ÄKª<›ó@ìþf=×c”@4ð,¿Ó´¤¼mϼfà8<Õ_@¾þ0=›©î>în¿qrÅ»õá€;ï÷ª;ä`@Öÿ˼‘ä¬?s®1¿kF›:| •»êŸn<ÛÔ@„ÿ¦¼5o@H¿GþE¼—´¼g<©<¸@Öý>벃@OG¿[»;­Ÿ¼¿1¨<{—@ôþf=Ô”@Vð,¿¸¯¡¼1ù¼{9<Ä-@Æþ0= ®î>Ñn¿FrÇ»U`;c~©;2¯@Öÿ˼óŬ?î1¿FBÃ:)“»tÐq<);@‚ÿ¥¼wë@ºH¿ïüA¼"¸³¼'¼¨<µW@Üý>?ǃ@äOG¿·;ƒý¼Ä¦<{7@üþg=DD”@yð,¿œªŸ¼d$¼ÙR9<û@Îþ0=g²î>´n¿rÈ»eØ‚;"¨;mÿ@Öÿ˼y§¬?¯1¿>ê:¢‘»·÷s<ϯ@€ÿ¥¼¦j@æH¿Ÿû=¼i~³¼§<»›@äý>…Ûƒ@*PG¿š²ö:>ʼ…ã£<ÜÑ@ÿg=n´”@›ð,¿€¥œ¼áO ¼ÂŒ:<„Ç@Öþ0=жî>—n¿ïqÊ»W‚;|Š¨;žN@Öÿ˼ÿˆ¬?i¯1¿ô9 ;&»xv<j/@|ÿ¤¼Ûì@H¿Wú9¼²²¼ç9¦<Ð@êý>¿ïƒ@rPG¿+®Û:Ç  ¼©¡<Ég@ ÿh=$”@½ð,¿d ™¼Ó| ¼ Ç;<Ê”@Üþ0=6»î>{n¿ÄqË» σ;†§;Ÿ@Öÿ˼†j¬?¯1¿Ê5;üŽ»´x<]¼@zÿ¤¼Cr@CH¿ù4¼2¡±¼ÚF¥<.ö@ôý >îƒ@¹PG¿²©À:ˆi ¼³^ž<²ü@ÿh=¥””@ßð,¿G›–¼ƒ« ¼&<<ï_@äþ0= ¿î>\n¿™qÍ»{Iƒ;R”¦;Ží@Ôÿ˼çK¬?°1¿¢10;²áŒ»({<^R@vÿ£¼û@uH¿Ë÷0¼7 °¼Æ:¥<Z@üý >ƒ@ QG¿.¥¥:Gr ¼`œ<Ú‹@ÿi=±”@ñ,¿,–“¼›Û¼_>=<w(@êþ0= Äî>?n¿nqλUÇ„;Ó¦;À=@Ôÿ˼-¬?}°1¿z-D;ï­Š».
  3 Comments
Jake
Jake on 6 Jul 2012
This is what I get when I open it with Notepad.

Sign in to comment.

Accepted Answer

Ken Atwell
Ken Atwell on 6 Jul 2012
Okay, binary data. :( Do you know what the file is supposed to contain? What is created on a Intel x86 machine (that is, is the floating point format likely to be compatible with your current machine)? Unless you know something about the data you are reading in, you're flying blind.
I might be tempted to try:
f = fopen('foo.dat, 'rb');
D = fread(f, inf, '*float'); % Try '*double' too
fclose(f);
plot(D);
Does a signal eventually emerge in the plot? If there is a header following by a stream of vector data, you might see a burst of noise (the header) followed by the data.
Beyond this, I don't have a lot of ideas, sorry.
  4 Comments
Walter Roberson
Walter Roberson on 7 Jul 2012
Once you have fopen() the file as binary, you can use fseek() to move forward a particular number of bytes.
Question: was the data possibly written in VAX-G floating point format? Support for reading that was dropped a few years ago.
Jake
Jake on 18 Jul 2012
The Data was in written in VAX-D floating point format. I found this forum page that includes a function that will convert VAX-G and VAX-D into 'ieee'. Thanks for the idea and the help. -Jake

Sign in to comment.

More Answers (0)

Categories

Find more on Search Path in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!