| Bioinformatics Toolbox™ | ![]() |
[Peaks, Times]
= mzcdf2peaks(mzCDFStruct)
| mzCDFStruct | MATLAB structure containing information from a netCDF file, such as one created by the mzcdfread function. Its fields correspond to the variables and global attributes in a netCDF file. If a netCDF variable contains local attributes, an additional field is created, with the name of the field being the variable name appended with the _attributes string. The number and names of the fields will vary, depending on the mass spectrometer software, but typically there are mass_values and intensity_values fields. |
| Peaks | Either of the following:
|
| Times | Scalar of vector of retention times associated with a liquid chromatography/mass spectrometry (LC/MS) or gas chromatography/mass spectrometry (GC/MS) data set. If Times is a vector, the number of elements equals the number of peak lists contained in Peaks. |
[Peaks, Times] = mzcdf2peaks(mzCDFStruct) extracts peak information from mzCDFStruct, a MATLAB structure containing information from a netCDF file, such as one created by the mzcdfread function, and creates Peaks, a single matrix or a cell array of matrices containing mass/charge (m/z) values and ion intensity values, and Times, a scalar or vector of retention times associated with a liquid chromatography/mass spectrometry (LC/MS) or gas chromatography/mass spectrometry (GC/MS) data set.
mzCDFStruct contains fields that correspond to the variables and global attributes in a netCDF file. If a netCDF variable contains local attributes, an additional field is created, with the name of the field being the variable name appended with the _attributes string. The number and names of the fields will vary, depending on the mass spectrometer software, but typically there are mass_values and intensity_values fields.
In the following example, the file results.cdf is not provided.
Use the mzcdfread function to read a netCDF file into the MATLAB software as a structure. Then extract the peak information from the structure.
mzcdf_struct = mzcdfread('results.cdf');
[peaks,time] = mzcdf2peaks(mzcdf_struct)
peaks =
[7008x2 single]
[7008x2 single]
[7008x2 single]
[7008x2 single]
time =
8.3430
12.6130
16.8830
21.1530
Create a color map containing a color for each peak list (retention time).
colors = hsv(numel(peaks));
Create a 3-D figure of the peaks and add labels to it.
figure
hold on
for i = 1:numel(peaks)
t = repmat(time(i),size(peaks{i},1),1);
plot3(t,peaks{i}(:,1),peaks{i}(:,2),'color',colors(i,:))
end
view(70,60)
xlabel('Time')
ylabel(mzcdf_struct.mass_axis_label)
zlabel(mzcdf_struct.intensity_axis_label)

Bioinformatics Toolbox functions: msdotplot, mspalign, msppresample, mzcdfread
![]() | multialignwrite | mzcdfinfo | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |