MATLAB Answers

Artur
0

Load data from .MAT into .XML

Asked by Artur
on 19 Oct 2015
Latest activity Answered by Julian
on 19 Oct 2015
I made some measurements that are stored in .mat files as (e.g. 5x3) matrixes for different N conditions (so, generally 5x3xN-matrixes). How can I load the values from this matrixes into a .XML-pattern (see simplified version below)?
<?xml version="1.0" encoding="UTF-8"?>
<Data>
<X>1 2 3</X>
<Y>100 200 300 400 500</Y>
<ConditionAxis>25 125</ConditionAxis>
<Measurements>
<Condition>
<Values></Values>
<Values></Values>
<Values></Values>
<Values></Values>
<Values></Values>
% so that for the 1st condition it would be 5x3-matrix like this:
% <Values>1 2 3</Values>
% <Values>4 5 6</Values>
% <Values>7 8 9</Values>
% <Values>10 11 12</Values>
% <Values>13 14 15</Values>
</Condition>
<Condition>
<Values></Values>
<Values></Values>
<Values></Values>
<Values></Values>
<Values></Values>
% and here the other values for the 2nd condition and so on
</Condition>
</Measurements>
</Data>
Thanks before :)
Greetings, Artur

  0 Comments

Sign in to comment.

1 Answer

Answer by Julian
on 19 Oct 2015

With a single use-case you could just write your own function by expanding the example given in MATLAB help xmlwrite, or you could try out struct2xml or similar from the FileExchange...

  0 Comments

Sign in to comment.