Home > atmlab > arts > xml > xmlWriteVector.m

xmlWriteVector

PURPOSE ^

Writes a Vector to an XML file.

SYNOPSIS ^

function xmlWriteVector(fid, fidb, data, precision, attrlist)

DESCRIPTION ^

 Writes a Vector to an XML file.

    Internal function that should never be called directly.
    Use *xmlStore* instead.

 FORMAT   xmlWriteVector(fid, fidb, data, precision, attrlist)

 IN    fid       File descriptor
 IN    fidb      File descriptor for binary file
 IN    data      Vector
 IN    precision Precision
 IN    attrlist  Attribute list

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

xmlWriteVector.m

SOURCE CODE ^

0001 % Writes a Vector to an XML file.
0002 %
0003 %    Internal function that should never be called directly.
0004 %    Use *xmlStore* instead.
0005 %
0006 % FORMAT   xmlWriteVector(fid, fidb, data, precision, attrlist)
0007 %
0008 % IN    fid       File descriptor
0009 % IN    fidb      File descriptor for binary file
0010 % IN    data      Vector
0011 % IN    precision Precision
0012 % IN    attrlist  Attribute list
0013  
0014 % 2002-12-13  Created by Oliver Lemke.
0015 
0016 function xmlWriteVector(fid, fidb, data, precision, attrlist)
0017 
0018 if nargin < 5
0019   attrlist = [];
0020 end
0021 
0022 nrows = size (data, 1);
0023 ncols = size (data, 2);
0024 
0025 if nrows ~= 0 && ncols ~=0 && nrows ~= 1 && ncols ~= 1
0026   error ('Either columns or rows must have size 1 or both must be zero');
0027 end
0028 
0029 nelem = length (data);
0030 attrlist = xmlAddAttribute (attrlist, 'nelem', sprintf ('%d', nelem));
0031 
0032 xmlWriteTag (fid, 'Vector', attrlist);
0033 
0034 if (strcmp(precision, 'BINARY'))
0035     fwrite (fidb, data, 'double');
0036 else
0037     fprintf (fid, [xmlGetPrecisionFormatString(precision) '\n'], data);
0038 end
0039 
0040 xmlWriteCloseTag (fid, 'Vector');
0041

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005