jcampread
Read JCAMP-DX-formatted files
Description
reads data from JCAMPStruct
= jcampread(myFile
)myFile
, a JCAMP-DX-formatted
file, and returns the data in a MATLAB® structure.
Examples
Read and Plot Mass Spectrum Data from a JCAMP-DX File in MATLAB
Read the data from the JCAMP-DX-formatted file, ISAS_MS1.DX, provided with the software. The data came from http://www.jcamp-dx.org/testdata.html.
jcampStruct = jcampread('ISAS_MS1.DX')
jcampStruct = struct with fields:
Title: '2-Chlorphenol'
DataType: 'MASS SPECTRUM'
DataClass: 'PEAKTABLE'
Origin: 'H. Mayer, ISAS Dortmund'
Owner: 'COPYRIGHT (C) 1993 by ISAS Dortmund, FRG'
Blocks: [1×1 struct]
Notes: {8×2 cell}
Plot the mass spectrum.
stem(jcampStruct.Blocks.XData,jcampStruct.Blocks.YData, ".",MarkerEdgeColor="w"); title(jcampStruct.Title); xlabel(jcampStruct.Blocks.XUnits); ylabel(jcampStruct.Blocks.YUnits);
Input Arguments
myFile
— Input file
character array | character vector | string scalar
Input file, specified as one of these options.
Character vector or string scalar specifying a file name, a path and file name, or a URL pointing to a file. The referenced file is a JCAMP-DX-formatted file (ASCII text file). If you specify only a file name, that file must be on the MATLAB search path or in the current folder.
MATLAB character array that contains the text of a JCAMP-DX-formatted file.
JCAMP-DX is a file format for infrared, NMR, and mass
spectrometry data from the Joint Committee on Atomic
and Molecular Physical Data (JCAMP).
jcampread
supports reading data
from files saved with Versions 4.24, 5, or 6 of the
JCAMP-DX format. For more information about the
JCAMP-DX format, see http://www.jcamp-dx.org/testdata.html.
Data Types: char
| string
Output Arguments
JCAMPStruct
— Information extracted from JCAMP-DX-formatted file
structure
Information extracted from the JCAMP-DX-formatted
file, returned as a MATLAB structure.
JCAMPStruct
contains these
fields.
Field | Description |
---|---|
Title | Title of the dataset |
DataType | Type of data contained in the file |
DataClass (version 5.00
and above) | Class of data |
Origin | Origin of the data |
Owner | Owner of the data |
Blocks | Array of structures |
Notes | Additional comments |
The Blocks
field of the structure
is an array of structures corresponding to each set
of data in the file. These structures have the
following fields.
Field | Description |
---|---|
XData | x data values |
YData | y data values |
ZData (if multiple
blocks) | z data values |
XUnits | Units of the x data |
YUnits | Units of the y data |
ZUnits (if multiple
blocks) | Units of the z data |
Notes | Additional comments |
Data Types: struct
Version History
Introduced before R2006a
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)