Home > Libraries > Loaders > read_lvm.m



LVM_IMPORT Imports data from a LabView LVM file


function data = read_lvm(filename,verbose)


LVM_IMPORT Imports data from a LabView LVM file
 DATA = LVM_IMPORT(FILENAME,VERBOSE) returns the data from a LVM (.lvm)
  ASCII text file created by LabView.

 FILENAME    The name of the .lvm file, with or without ".lvm" extension

 VERBOSE     How many messages to display. Default is 1 (few messages),
              0 = silent, 2 = display file information and all messages

 DATA        The data found in the LVM file. DATA is a structure with 
              fields corresponding to the Segments in the file (see below) 
              and LVM file header information.

 This function imports data from a text-formatted LabView Measurement File
  (LVM, extension ".lvm") into MATLAB. A LVM file can have multiple
  Segments, so that multiple measurements can be combined in a single
  file. The output variable DATA is a structure with fields named
  'Segment1', 'Segment2', etc. Each Segment field is a structure with
  details about the data in the Segment and the actual data in the field
  named 'data'. The column labels and units are stored as cell arrays that
  correspond to the columns in the array of data.
 The size of the data array depends on the type of x-axis data that is
  stored in the LVM file and the number of channels (num_channels).
  There are three cases:
  1) No x-data is included in the file ('No')
   The data array will have num_channels columns (one column per channel
   of data).
  2) One column of x-data is included in the file ('One')
   The first column of the data array will be the x-values, and the data
   array will have num_channels+1 columns.
  3) Each channel has its own x-data ('Multi')
   Each channel has two columns, one for x-values, and one for data. The
   data array will have num_channels*2 columns, with the x-values and
   corresponding data in alternating columns. For example, in a Segment
   with 4 channels, columns 1,3,5,7 will be the x-values for the data in
   columns 2,4,6,8.

 Note: because MATLAB only works with a "." decimal separator, importing
  large LVM files that use a "," (or other character) will be noticeably
  slower. Use a "." decimal separator to avoid this issue.

 The LVM file specification is available at:

 Contrib from:


  Use the following command to read in the data from a file containing two

 >> d=lvm_import('testfile.lvm');

 Importing testfile.lvm:

 Import complete. 2 Segments found.

 >> d
 d = 
       X_Columns: 'One'
            user: 'hopcroft'
     Description: 'Pressure, Flowrate, Heat, Power, Analog Voltage, Pump on, Temp'
            date: '2008/03/26'
            time: '12:18:02.156616'
           clock: [2008 3 26 12 18 2.156616]
        Segment1: [1x1 struct]
        Segment2: [1x1 struct]

 >> d.Segment1
 ans = 
            Notes: 'Some notes regarding this data set'
     num_channels: 8
          y_units: {8x1 cell}
          x_units: {8x1 cell}
               X0: [8x1 double]
          Delta_X: [8x1 double]
    column_labels: {9x1 cell}
             data: [211x9 double]
          Comment: 'This data rulz'

 >> d.Segment1.column_labels{2}
 ans =

 >> plot(d.Segment1.data(:,1),d.Segment1.data(:,2));
 >> xlabel(d.Segment1.column_labels{1});
 >> ylabel(d.Segment1.column_labels{2});

 M.A. Hopcroft
      < mhopeng at gmail.com >

 See also: read_tdms, read_igor, read_idl


This function calls: This function is called by:
Generated on Wed 22-Mar-2017 09:13:30 by m2html © 2005. iFit (c) E.Farhi/ILL EUPL 1.1