I would like to write a filter for Import to handle data files that are generated by LabView in the LVM format. This should be straightforward, since the format is supposed to consist of comma delimited ASCII text. However, if I read the file in normally, I get junk with a few legible snippets mixed in.

The file can be opened directly in MS Excel, so my guess is that the ASCII data is compressed and being unzipped transparently when it is opened in that program.

BinaryReadList["data.lvm", "Character8"]

(* Large output: {P,K,\.03,\.04 ... *)

I've posted the output of BinaryReadList here. The original data file can be downloaded here.

Are there any facilities available in Mathematica to deal with this kind of data?

  • $\begingroup$ the lvm format itself is not compressed. do you know the history of the file? can you make it available? $\endgroup$
    – george2079
    Apr 21 '15 at 12:00
  • $\begingroup$ @george2079 I added a download link for the data file. $\endgroup$
    – dionys
    Apr 21 '15 at 12:21
  • $\begingroup$ @george2079 The first few characters look like the magic numbers for a zip file to me: "PK\003\004" $\endgroup$
    – dionys
    Apr 21 '15 at 12:23
  • $\begingroup$ see what this does.. reference.wolfram.com/language/ref/ExtractArchive.html $\endgroup$
    – george2079
    Apr 21 '15 at 13:29
  • $\begingroup$ @george2079 Interesting: ExtractArchive gives me a 4 folders (xl, NI, docProps, and _rels) containing XML files. $\endgroup$
    – dionys
    Apr 21 '15 at 13:37

This is a standard Excel XLSX file. It is not a compressed ASCII file. I don't know why LabView uses the lvm extension, it seems weird. But then I don't know anything about LabView.

Just use

Import["data.lvm", "XLSX"]

Note: Office Open XML files are actually just ZIP files with a standardized directory structure with XML files inside. This is why you can unzip it.

  • $\begingroup$ possibly someone saved the file in excel and then gave it the wrong extension. $\endgroup$
    – george2079
    Apr 21 '15 at 16:37
  • $\begingroup$ @Szabolcs Thanks, this is indeed the case. After your insights, I found this answer helpful for importing the data in a more convenient form. $\endgroup$
    – dionys
    Apr 22 '15 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.