Jcampreadr: Difference between revisions
imported>Jeremy (Importing text file) |
imported>Donal |
||
(12 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
===Purpose=== | ===Purpose=== | ||
Line 6: | Line 5: | ||
===Synopsis=== | ===Synopsis=== | ||
:data = jcampreadr(' | :[data,wrn] = jcampreadr(filename,''options'') | ||
===Description=== | ===Description=== | ||
Input is the filename of a JCAMP file to read. If omitted, the user is prompted for a file. | Input is the filename of a JCAMP file to read. If omitted, the user is prompted for a file. The reader reads files of type: | ||
:ND NMR SPECTRUM, | |||
:NMR SPECTRUM, | |||
:INFRARED SPECTRUM, | |||
:MASS SPECTRUM, | |||
:RAMAN SPECTRUM, | |||
:GAS CHROMATOGRAM, | |||
:UV/VIS SPECTRUM. | |||
including any files written in JCAMP-DX format (with limited support for beta version 6). | |||
This importer uses JSpecView, a Java package which enables importing of files written the JCAMP-DX format. JSpecView was developed at the Department of Chemistry of the University of the West Indies, Mona, Jamaica, WI. | |||
JSpecView is described in an article available at:[http://journal.chemistrycentral.com/content/1/1/31 JSpecView]. | |||
Multiple input files must contain the same axisscale for the wavelength (variables) mode. The imported files are returned in a Dataset Object. If the file contains peaktable(s) they are extracted and stored in the returned DataSet's userdata field. | |||
====Optional Inputs==== | |||
*'''filename''' = specifies the file(s) to read using: | |||
::'''(a)''' a string specifying a single file to read | |||
::'''(b)''' a cell array of strings specifying multiple files to read | |||
::'''(c)''' the output of the MATLAB "dir" command specifying multiple files to read | |||
:If fname is an empty string or matrix or is not supplied, the user is prompted to identify file(s) to load. | |||
*'''options''' = an optional options structure. See Options below. | |||
====Outputs==== | |||
* '''out''' = takes one of two forms: | |||
# If input is a single file, or multiple files containing data that can be combined (same number of data points, same x-axis range, same type of data), the output is a dataset object, | |||
# If the input consists of multiple files containing data that cannot simply be combined (different number of data points, differing x-axis ranges, etc), the output is either: | |||
::: a) a cell array with a dataset object for each input file if the 'nonmatching' option has value 'cell', or | |||
::: b) a dataset object containing the input data combined using the MATCHVARS function if the 'nonmatching' option has value 'matchvars'. | |||
*'''wrn''' = a cell array of warnings issued during the reading of the file. | |||
===Options=== | |||
Input 'options' is an options structure containing the following fields | |||
*'''display''': <tt>[{'off'}| 'on' ]</tt> Governs display to the command line. Warnings encountered during file load will be supressed if display is 'off'. | |||
*'''waitbar''': <tt>[ 'off' |{'on'}]</tt> Governs display of a progress bar when doing multiple file reading. | |||
* '''nonmatching''': [ 'error' |{'matchvars'} 'cell'] governs behavior when multiple files are being read which cannot be combined due to mismatched types, sizes, etc. | |||
** 'matchvars' returns a dataset object, | |||
** 'cell' returns cell (see Outputs,), | |||
** 'error' gives an error. | |||
===See Also=== | ===See Also=== | ||
[[spcreadr]], [[xclreadr]] | [[Data Importing Formats]], [[spcreadr]], [[writespc]], [[xclreadr]] |
Latest revision as of 14:10, 18 June 2015
Purpose
Reads a JCAMP file into a DataSet object.
Synopsis
- [data,wrn] = jcampreadr(filename,options)
Description
Input is the filename of a JCAMP file to read. If omitted, the user is prompted for a file. The reader reads files of type:
- ND NMR SPECTRUM,
- NMR SPECTRUM,
- INFRARED SPECTRUM,
- MASS SPECTRUM,
- RAMAN SPECTRUM,
- GAS CHROMATOGRAM,
- UV/VIS SPECTRUM.
including any files written in JCAMP-DX format (with limited support for beta version 6).
This importer uses JSpecView, a Java package which enables importing of files written the JCAMP-DX format. JSpecView was developed at the Department of Chemistry of the University of the West Indies, Mona, Jamaica, WI. JSpecView is described in an article available at:JSpecView.
Multiple input files must contain the same axisscale for the wavelength (variables) mode. The imported files are returned in a Dataset Object. If the file contains peaktable(s) they are extracted and stored in the returned DataSet's userdata field.
Optional Inputs
- filename = specifies the file(s) to read using:
- (a) a string specifying a single file to read
- (b) a cell array of strings specifying multiple files to read
- (c) the output of the MATLAB "dir" command specifying multiple files to read
- If fname is an empty string or matrix or is not supplied, the user is prompted to identify file(s) to load.
- options = an optional options structure. See Options below.
Outputs
- out = takes one of two forms:
- If input is a single file, or multiple files containing data that can be combined (same number of data points, same x-axis range, same type of data), the output is a dataset object,
- If the input consists of multiple files containing data that cannot simply be combined (different number of data points, differing x-axis ranges, etc), the output is either:
- a) a cell array with a dataset object for each input file if the 'nonmatching' option has value 'cell', or
- b) a dataset object containing the input data combined using the MATCHVARS function if the 'nonmatching' option has value 'matchvars'.
- wrn = a cell array of warnings issued during the reading of the file.
Options
Input 'options' is an options structure containing the following fields
- display: [{'off'}| 'on' ] Governs display to the command line. Warnings encountered during file load will be supressed if display is 'off'.
- waitbar: [ 'off' |{'on'}] Governs display of a progress bar when doing multiple file reading.
- nonmatching: [ 'error' |{'matchvars'} 'cell'] governs behavior when multiple files are being read which cannot be combined due to mismatched types, sizes, etc.
- 'matchvars' returns a dataset object,
- 'cell' returns cell (see Outputs,),
- 'error' gives an error.