Home > atmlab > arts > xml > xmlWriteArrayOf.m

xmlWriteArrayOf

PURPOSE ^

Writes an Array to an XML file.

SYNOPSIS ^

function xmlWriteArrayOf(fid, fidb, data, type, precision, attrlist)

DESCRIPTION ^

 Writes an Array to an XML file.

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

 FORMAT   xmlWriteArrayOf(fid, fidb, data, type, precision)

 IN    fid        File descriptor
 IN    fidb       File descriptor for binary file
 IN    data       Array
 IN    type       Data type as string
 IN    precision  Precision for floats
 IN    attrlist   Attribute list

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

xmlWriteArrayOf.m

SOURCE CODE ^

0001 % Writes an Array to an XML file.
0002 %
0003 %    Internal function that should never be called directly.
0004 %    Use *xmlStore* instead.
0005 %
0006 % FORMAT   xmlWriteArrayOf(fid, fidb, data, type, precision)
0007 %
0008 % IN    fid        File descriptor
0009 % IN    fidb       File descriptor for binary file
0010 % IN    data       Array
0011 % IN    type       Data type as string
0012 % IN    precision  Precision for floats
0013 % IN    attrlist   Attribute list
0014 
0015 % 2002-12-16  Created by Oliver Lemke.
0016 
0017 function xmlWriteArrayOf(fid, fidb, data, type, precision, attrlist)
0018 
0019 nrows = size (data, 1);
0020 ncols = size (data, 2);
0021 
0022 if nrows ~= 0 && ncols ~=0 && nrows ~= 1 && ncols ~= 1
0023   error ('Either columns or rows must have size 1 or both must be zero');
0024 end
0025 
0026 nelem = length (data);
0027 
0028 if (nargin < 6)
0029   attrlist = [];
0030 end
0031 attrlist = xmlAddAttribute (attrlist, 'type', type);
0032 attrlist = xmlAddAttribute (attrlist, 'nelem', sprintf ('%d', nelem));
0033 xmlWriteTag (fid, 'Array', attrlist);
0034 func = str2func (['xmlWrite' type]);
0035 for i = 1:nelem
0036   feval (func, fid, fidb, data{i}, precision);
0037 end
0038 xmlWriteCloseTag (fid, 'Array');
0039

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