National Instruments TDMS File Reader for .NET and Mono.
C# HTML JavaScript Batchfile
Latest commit 4c4519c Jun 1, 2016 @mikeobrien Updated the readme.
Permalink
Failed to load latest commit information.
misc Added gulp build. Dec 6, 2014
src
.gitignore Added gulp build. Dec 6, 2014
.travis.yml Added gulp build. Dec 6, 2014
LICENSE Added gulp build. Dec 6, 2014
README.md Updated the readme. Jun 1, 2016
TDMSReader.nuspec
gulpfile.js Fixed a bug in the build script. Dec 6, 2014
package.json Fixed a bug in the nuget spec. Dec 6, 2014

README.md

TDMS Reader

Nuget Travis CI Build Status TeamCity Build Status

A managed library for reading TDMS files.

Install

TDMSReader can be found on nuget:

PM> Install-Package TDMSReader

Usage

The folowing demonstrates how to read data from a TDMS file.

using (var output = new System.IO.StreamWriter(System.IO.File.Create(@"D:\export.txt")))
using (var tdms = new NationalInstruments.Tdms.File("Sample.tdms"))
{
    tdms.Open();

    foreach (var value in tdms.Groups["Noise data"].Channels["Noise_1"].GetData<double>())
        output.WriteLine(value);
}

The folowing demonstrates enumeration of properties, groups and channels.

using (var output = new System.IO.StreamWriter(System.IO.File.Create(@"D:\tdms.overvw.txt")))
using (var tdms = new NationalInstruments.Tdms.File("Sample.tdms"))
{
    tdms.Open();

    output.WriteLine("Properties:");
    foreach (var property in tdms.Properties)
        output.WriteLine("  {0}: {1}", property.Key, property.Value);
    output.WriteLine();
    foreach (var group in tdms)
    {
        output.WriteLine("    Group: {0}", group.Name);
        foreach (var property in group.Properties)
            output.WriteLine("    {0}: {1}", property.Key, property.Value);
        output.WriteLine();
        foreach (var channel in group)
        {
            output.WriteLine("        Channel: {0}", channel.Name);
            foreach (var property in channel.Properties)
                output.WriteLine("        {0}: {1}", property.Key, property.Value);
            output.WriteLine();
        }
    }

    output.WriteLine("Data:");
    foreach (var group in tdms)
    {
        output.WriteLine("    Group: {0}", group.Name);
        foreach (var channel in group)
        {
            output.WriteLine("    Channel: {0} ({1} data points of type {2})", channel.Name,
                                channel.DataCount, channel.DataType);
            foreach (var value in channel.GetData<object>().Take(20))
                output.WriteLine("          {0}", value);
            if (channel.DataCount > 20) output.WriteLine("        ...");
            output.WriteLine();
        }
    }
}

Contributors

Huge thanks to Tommy Jakobsen for adding interleaved data support!

Tommy Jakobsen
Tommy Jakobsen

Props

Thanks to JetBrains for providing OSS licenses!

License

MIT License