fid = fopen('history.m'); % Create the document node and the root element, 'history' docNode = com.mathworks.xml.XMLUtils.createDocument('history'); % Get the history node history = docNode.getDocumentElement; % Read the first line of the old history.m file line = fgetl(fid); % Loop through every line of the old history.m file while there are lines while ischar(line) % Add a command element for each command command = docNode.createElement('command'); % Add the command itself as the child text node command.appendChild(docNode.createTextNode(line)); % Add the command node back as a child of the command node history.appendChild(command); % Get the next line of the old history.m file line = fgetl(fid); end % Close the file fclose(fid); % Write the XML file xmlwrite('History.xml',docNode);
Monday, May 4, 2015
Convert MATLAB history.m to History.xml
Link.
Labels:
Matlab
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment