Main Content

tgspcread

Read data from SPC file

Description

SPCStruct = tgspcread(myFile) reads a Galactic SPC file from Thermo Scientific®, and returns the data in a MATLAB® structure.

SPCStruct = tgspcread(myFile,Name=Value) sets file reading parameters using one or more optional name-value arguments. For example, Verbose=true sets the display control of the file reading progress to true.

example

Examples

collapse all

To read and plot an SPC file, follow the steps in this example. This example assumes that you already have an SPC file to use. Bioinformatics Toolbox™ does not include a sample.spc file.

Read an SPC file.

% Read the contents of an SPC file into a MATLAB structure
out = tgspcread('results.spc')
File contains 1 scans

out = 

    Header: [1x1 struct]
         X: [12031x1 single]
         Y: [12031x1 double]
         Z: 0

Plot an SPC file.

% Plot the first scan in the SPC file:
plot(out.X,out.Y(:,1));

Input Arguments

collapse all

Input file, specified as a character vector or string containing an SPC file name or the path and file name of an SPC file. The SPC file must conforms to the Thermo Scientific Universal Data Format Specification. If you specify only a file name, that file must be on the MATLAB search path or in the current folder.

Data Types: char | string

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: For example, Verbose=true sets the display control of the file reading progress to true.

Range of z data values in myFile to read, specified as a two-element numeric array [Start End]. The Start value must be less than the End value. By default, the tgspcread function extracts all available scans from the file.

Tip

For summary information about the z data values in an SPC file, see the tgspcinfo function.

Dependencies

To use this name-value argument, you must not specify ScanIndices.

Data Types: double

Scans in the input file to read, specified as a positive integer (one scan), a vector of integers (multiple scans), or a two-element numeric array [StartInd: EndInd] (range of scans). StartInd and EndInd are each positive integers indicating a scan index. The StartInd value must be less than the EndInd value. If you do not specify a range, by default, the tgspcread function reads all available scans from the file.

Tip

For summary information about the scan indices in an SPC file, check the NumScans field in the structure returned by the tgspcinfo function.

Dependencies

To use this name-value argument, you must not specify ZRange.

Data Types: double

Display control of the file reading progress, specified as true (1) or false (0).

Data Types: logical

Output Arguments

collapse all

Information extracted from an SPC file, returned as a structure. The structure contains these fields.

FieldDescription
Header

Structure containing these fields:

  • Filename — Name of the SPC file.

  • FileSize — Size of the SPC file in bytes.

  • ExperimentType — Experimental technique used to create the data.

  • NumDataPoints — Number of data points (y data values) in the SPC file.

  • XFirst — First x data value in the SPC file.

  • XLast — Last x data value in the SPC file.

  • NumScans — Number of scans or subfiles in the SPC file.

  • XLabel — Label for the x data values.

  • YLabel — Label for the y data values.

  • ZLabel — Label for the z data values.

  • CollectionTime — Date and time the scan data were collected.

  • CollectionTimeDatenum — Date and time the scan data were collected in serial date number format. For more information, see datenum.

  • Resolution — Instrument resolution.

  • SourceInstrument — Name or model of instrument used to collect data.

  • InterferogramPeakPointNumber — Peak point number for interferograms. It is 0 for scans that are not interferograms.

  • Comment — User-provided comments.

  • CustomAxisUnitLabel — User-provided labels for the axis units.

  • SubScanHeaders — Header information for subfiles or scans, including scan index, next scan index, and w data value.

  • ZValues — Vector containing the z data values of all scans in the SPC file.

X

Vector or cell array containing the x data values.

If all scans share the same x data values, then X is a vector. If scans have different x data values, then X is a cell array.

Y

Vector, matrix, or cell array containing the y data values.

If only one scan exists, Y is a vector. Multiple scans with the same x data values result in Y as a matrix. Multiple scans with different xdata values make Y a cell array.

Z

Vector containing the z data values of scans read from the SPC file

Data Types: struct

Version History

Introduced in R2009b