Documentation

jcampread

Read JCAMP-DX-formatted files

Syntax

JCAMPStruct = jcampread(File)

Input Arguments

File

Either of the following:

  • String 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.

Output Arguments

JCAMPStructMATLAB structure containing information from a JCAMP-DX-formatted file.

Description

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 details, see:

http://www.jcamp-dx.org/

JCAMPStruct = jcampread(File) reads data from File, a JCAMP-DX-formatted file, and creates JCAMPStruct, a MATLAB structure containing the following fields.

Field
Title
DataType
DataClass
Origin
Owner
Blocks
Notes

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
XData
YData
XUnits
YUnits
Notes

Examples

  1. Open a Web browser to

    http://www.jcamp-dx.org/testdata.html
    
  2. Download the testdata.zip file to your MATLAB Current Folder.

  3. Extract isas_ms1.dx, a JCAMP-DX-formatted file, from the testdata.zip file to your MATLAB Current Folder.

  4. Read the data from the JCAMP-DX-formatted file, isas_ms1.dx, into the MATLAB software

    jcampStruct = jcampread('isas_ms1.dx') 
    
    jcampStruct = 
    
            Title: '2-Chlorphenol'
         DataType: 'MASS SPECTRUM'
        DataClass: 'PEAKTABLE'
           Origin: 'H. Mayer, ISAS Dortmund'
            Owner: 'COPYRIGHT (C) 1993 by ISAS Dortmund, FRG'
           Blocks: [1x1 struct]
            Notes: {8x2 cell}
    
  5. Plot the mass spectrum.

    data = jcampStruct.Blocks(1); 
    stem(data.XData,data.YData, '.', 'MarkerEdgeColor','w');
    title(jcampStruct.Title); 
    xlabel(data.XUnits); 
    ylabel(data.YUnits);

Was this topic helpful?