Main Content

jcampread

Read JCAMP-DX-formatted files

Description

JCAMPStruct = jcampread(myFile) reads data from myFile, a JCAMP-DX-formatted file, and returns the data in a MATLAB® structure.

example

Examples

collapse all

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

Figure contains an axes object. The axes object with title 2-Chlorphenol, xlabel M/Z, ylabel RELATIVE ABUNDANCE contains an object of type stem.

Input Arguments

collapse all

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

collapse all

Information extracted from the JCAMP-DX-formatted file, returned as a MATLAB structure. JCAMPStruct contains these fields.

FieldDescription
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.

FieldDescription
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