Home > atmlab > arts > xml > xmlWriteSparse.m

xmlWriteSparse

PURPOSE ^

Writes a Sparse to an XML file.

SYNOPSIS ^

function xmlWriteSparse(fid, fidb, data, precision)

DESCRIPTION ^

 Writes a Sparse to an XML file.

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

 FORMAT   xmlWriteSparse(fid, fidb, data, precision)

 IN    fid        File descriptor
 IN    fidb       File descriptor for binary file
 IN    data       Sparse
 IN    precision  Precision for floats

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

xmlWriteSparse.m

SOURCE CODE ^

0001 % Writes a Sparse to an XML file.
0002 %
0003 %    Internal function that should never be called directly.
0004 %    Use *xmlStore* instead.
0005 %
0006 % FORMAT   xmlWriteSparse(fid, fidb, data, precision)
0007 %
0008 % IN    fid        File descriptor
0009 % IN    fidb       File descriptor for binary file
0010 % IN    data       Sparse
0011 % IN    precision  Precision for floats
0012 
0013 % 2003-06-16  Created by Mattias Ekstr´┐Ż.
0014 
0015 function xmlWriteSparse(fid, fidb, data, precision)
0016 
0017 s = size (data);
0018 
0019 nr = s(1);
0020 nc = s(2);
0021 
0022 attrlist = [];
0023 attrlist = xmlAddAttribute (attrlist, 'nrows', sprintf ('%d', nr));
0024 attrlist = xmlAddAttribute (attrlist, 'ncols', sprintf ('%d', nc));
0025 
0026 xmlWriteTag (fid, 'Sparse', attrlist);
0027 
0028 [r,c] = find (data);
0029 
0030 xmlWriteRowIndex (fid, fidb, r - 1, precision);
0031 xmlWriteColIndex (fid, fidb, c - 1, precision);
0032 xmlWriteSparseData (fid, fidb, nonzeros(data), precision);
0033 
0034 xmlWriteCloseTag (fid, 'Sparse');
0035

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