Main Content

tgspcread

Read data from SPC file

Syntax

SPCStruct = tgspcread(File)
tgspcread(..., 'ZRange', ZRangeValue, ...)
tgspcread(..., 'ScanIndices', ScanIndicesValue, ...)
tgspcread(..., 'Verbose', VerboseValue, ...)

Description

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

tgspcread(..., 'PropertyName', PropertyValue, ...) calls tgspcread with optional properties that use property name/property value pairs. You can specify one or more properties in any order. Enclose each PropertyName in single quotation marks. Each PropertyName is case insensitive. These property name/property value pairs are as follows:

tgspcread(..., 'ZRange', ZRangeValue, ...) specifies a range of z data values in the SPC file from which to extract scans.

tgspcread(..., 'ScanIndices', ScanIndicesValue, ...) specifies a scan, multiple scans, or range of scans in the SPC file to read.

tgspcread(..., 'Verbose', VerboseValue, ...) controls the display of the progress of the reading of the SPC file. Choices are true (default) or false.

Input Arguments

File

Character vector or string specifying a file name or path and file name of an SPC file that 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.

ZRangeValue

Two-element numeric array [Start End] that specifies the range of z data values in File to read. Start and End must be positive scalars, and Start must be less than End. Default is to extract all scans.

Tip

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

Note

If you specify a ZRangeValue, you cannot specify a ScanIndicesValue.

ScanIndicesValue

Positive integer, vector of integers, or a two-element numeric array [Start_Ind: End_Ind] that specifies a scan, multiple scans, or a range of scans in File to read. Start_Ind and End_Ind are each positive integers indicating a scan index. Start_Ind must be less than End_Ind. Default is to read all scans.

Tip

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

Note

If you specify a ScanIndicesValue, you cannot specify a ZRangeValue.

VerboseValue

Controls the display of the progress of the reading of File. Choices are true (default) or false.

Output Arguments

SPCStruct

Structure containing information from an SPC file. The structure contains the following fields.

FieldDescription
Header

Structure containing the following 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 there is only one scan, then Y is a vector. If there are multiple scans that share the same x data values, then Y is a matrix. If there are multiple scans having different x data values, then Y is a cell array.

Z

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

Examples

This example assumes that you already have an SPC file to use. sample.spc file is not provided with the Bioinformatics Toolbox™ software.

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));

Version History

Introduced in R2009b