tgspcread
Read data from SPC file
Description
sets file reading parameters using one or more optional name-value arguments. For
example, SPCStruct
= tgspcread(myFile
,Name=Value
)Verbose=true
sets the display control of the file
reading progress to true
.
Examples
Read and Plot SPC file
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
myFile
— Input file
character vector | string
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
.
ZRange
— Range of z data values
two-element numeric array of positive scalars
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
ScanIndices
— Scans in file to read
positive integer | vector of positive integers | two-element numeric array of positive integers
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
Verbose
— Display control of file reading progress
true
(default) | 1
| false
| 0
Display control of the file reading progress, specified as
true
(1
) or
false
(0
).
Data Types: logical
Output Arguments
SPCStruct
— Information extracted from SPC file
structure
Information extracted from an SPC file, returned as a structure. The structure contains these fields.
Field | Description |
---|---|
Header | Structure containing these fields:
|
X | Vector or cell array containing the x data values. If
all scans share the same x data
values, then |
Y | Vector, matrix, or cell array containing the y data values. If
only one scan exists, |
Z | Vector containing the z data values of scans read from the SPC file |
Data Types: struct
Version History
Introduced in R2009b
See Also
tgspcinfo
| jcampread
| mzcdfinfo
| mzcdf2peaks
| mzcdfread
| mzxmlread
| mzxml2peaks
| mzxmlinfo
| datenum
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)