4.0

4.0 | 1 rating Rate this file 80 Downloads (last 30 days) File Size: 5.5 KB File ID: #19913

LVM file import

by M. A. Hopcroft

 

13 May 2008 (Updated 10 Oct 2011)

Imports LabView .lvm data files into MATLAB

| Watch this File

File Information
Description

National Instruments LabView software has a native file format called LabView Measurement File (LVM, extension .lvm). This m-file, lvm_import.m, reads LVM files and imports the data into the MATLAB workspace.
LVM is an ascii text file format, and the data can be imported into MATLAB using the built-in import.m function. However, import.m has some limitations: it cannot handle multi-part LVM files, and it does not return the contents of the file and section headers. lvm_import.m handles all types of LVM files, and returns specific information such as date, time, data column names, etc.

MATLAB release MATLAB 7.1.0 (R14SP3)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (10)
17 Jun 2008 Sung Jin Kim

very good

26 Aug 2008 Gerald Knebl

excellent programmed with good performance.
What I like to suggest is to make it compatible with multi x files as well.
really good work

30 Apr 2009 Vepashka

Sir im trying to import lvm file into matlab using ur lvm_import.m,that was acquired from some sensors.Im running the program but in each run i face with this problem.
"??? Index exceeds matrix dimensions.

Error in ==> lvm_import at 357
    data.(fieldnm).Comment = rawdata{numdatacols+2}{1};"
What am i gonno do??Need a help,plsss!

14 Apr 2010 Farzad Rafieian

Hi,

Thanks for the file, but for my data it came up with the follwoing error message :

>> lvm_import('Data07v2.LVM');

Importing Data07v2.LVM:

??? Index exceeds matrix dimensions.

Error in ==> lvm_import at 164
        val = v_in{1}{1};

Can you help me in this regard ?

14 Apr 2010 Farzad Rafieian

Hi,

Thanks for the file, but for my data it came up with the follwoing error message :

>> lvm_import('Data07v2.LVM');

Importing Data07v2.LVM:

??? Index exceeds matrix dimensions.

Error in ==> lvm_import at 164
        val = v_in{1}{1};

Can you help me in this regard ?

15 Apr 2010 Farzad Rafieian

To inform any future reference to this page, the updated file on 15 Apr 2010 worked fine with my problem mentioned above.

13 Jul 2010 Jo

Two bugs in the code that prevent it from working(possibly more) with some lvm files.

one is mulitple tabs. Changed line 178 to
        v_in = textscan(linein,'%*s %s','delimiter','\t','whitespace','','MultipleDelimsAsOne', 1);

second is muliple lines: there is a check at line 237 for a single extra line but it should be more general skipping over all extra blank lines
---
for example, in my lvm the data had two tab's and two extra blank lines after the first header.
while (isempty(linein))
if (feof(fid)), return; end;
linein=fgetl(fid);
end;

09 Sep 2010 M. A. Hopcroft

Note: the latest version (v1.2) uses the suggestions from Jo (13Jul2010), related to "Special" headers in the LVM file.

30 Sep 2011 Kenneth

Dear all,

Thanks for a great *.m file. I'm having a bit of trouble though, I'm trying to load a *.lvm file like this short 4KB example http://dl.dropbox.com/u/12840152/test18xy.lvm pretty standard 2011 *.lvm file I guess.

I) When I use the v1.2 lvm_import file as it is I get the same error as "Vepashka" above as "Error in ==> lvm_import at 357
    data.(fieldnm).Comment = rawdata{numdatacols+2}{1};"

II) When I comment out the "consolidate into a simple array" part starting at line 349 and just keep the line 349 "data.data=rawdata" then I am able to complete the import

The only trouble with method II) is that my data.data struct is empty! Any help would be much appreciated as I'm struggling with my master thesis

Thanks,
Kenneth Rasmussen

10 Oct 2011 M. A. Hopcroft

Several people have reported problems where data cannot be imported. This may be related to LVM files that use a comma as a decimal separator instead of a period. This has been fixed in the latest version of lvm_import (and also in the NI LVM software).

Please login to add a comment or rating.
Updates
04 Sep 2008

Added support for Multi-X column files
Added support for "no-header" files
Added per-Segment Comment extraction

29 Sep 2008

Fix comments, add Cells

15 Apr 2010

v1.1 update to stay compatible with latest NI version

09 Sep 2010

v1.2 bugfixes for "Special Headers".

10 Oct 2011

Updated for LVM version 2.0 (decimal separator)

Tag Activity for this File
Tag Applied By Date/Time
data import M. A. Hopcroft 22 Oct 2008 10:01:17
data export M. A. Hopcroft 22 Oct 2008 10:01:17
lvm M. A. Hopcroft 22 Oct 2008 10:01:17
labview M. A. Hopcroft 22 Oct 2008 10:01:17
national instruments M. A. Hopcroft 22 Oct 2008 10:01:17
data file M. A. Hopcroft 22 Oct 2008 10:01:17
import M. A. Hopcroft 22 Oct 2008 10:01:17
data export Rui Gomes 13 Nov 2008 10:05:30
data file Rui Gomes 13 Nov 2008 10:05:34
data export Curtis 29 Sep 2009 15:09:05
lvm VIET THANH PHAM 05 Apr 2011 17:48:28
data export ZJU 13 Apr 2011 01:01:21
data file ZJU 13 Apr 2011 01:01:24
data import Dirk Wiedmann 11 May 2011 03:14:14
labview Seyed 02 Jun 2011 11:22:07
lvm Seyed 02 Jun 2011 11:22:10

Contact us at files@mathworks.com