フィルターのクリア

Save Matrix into XML

3 ビュー (過去 30 日間)
Smiljan
Smiljan 2012 年 7 月 30 日
回答済み: Mavarick 2017 年 6 月 29 日
Hello,
I have a Matrix and i need to save it to xml.
My problem is, that i need to make some adjustements.
I want the first colum to be the DOM and the other ones to be the child.
For example:
1 23 24 25 26 27 27 ;
2 34 35 34 34 34 34 ;
1 23 34 34 34 34 34 ;
Now i need it to be kinda like this:
<d>23</d>
<l>24</l>
etc.
<d>34</d>
<l>35</l>
etc.
etc.
Can somebody help me with this problem? I don't know how to choose the columns
  1 件のコメント
Smiljan
Smiljan 2012 年 8 月 11 日
Is there nobody who can tell me how to choose a column from my matrix`?

サインインしてコメントする。

回答 (2 件)

the cyclist
the cyclist 2012 年 8 月 11 日
I did not fully understand what you wanted for output, but you should be able to adapt this simple version to exactly what you wanted:
x = [1 23 24 25 26 27 27; ...
2 34 35 34 34 34 34; ...
1 23 34 34 34 34 34];
x = [x,x(:,1)];
A = sprintf('\n<d><%d></d>\n<l><%d></l> <%d><%d><%d><%d>\n\n',x')

Mavarick
Mavarick 2017 年 6 月 29 日
Hello, thank you for the tip. I have a question and that is: how do you save the variable A into a XML file?

カテゴリ

Help Center および File ExchangeStructured Data and XML Documents についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by