天天看點

matlab下生成的矩陣存入xml檔案中

參考:http://blog.csdn.net/wzy1990/article/details/8508662

 % name是輸入的檔案名,data是matlab中的矩陣

function createxml(name,datatest)

xdoc=com.mathworks.xml.XMLUtils.createDocument('opencv_storage');  

xroot=xdoc.getDocumentElement;  

%  

[m,n]=size(datatest);  

type=xdoc.createElement(name);  

xroot.appendChild(type);  

type.setAttribute('type_id','opencv-matrix')  

%  

rows=xdoc.createElement('rows');  

rows.appendChild(xdoc.createTextNode(sprintf('