Hello,
I am trying to interface with a custom instrument using TCP/IP. The instruments communication is done through the use of XML based messages. Is it possible to send XML over TCP/IP in MATLAB. The XML is enclosed in a STX character (2) and a ETX character (3) to make the message easy to recognize.
I can connect to the instrument using a client TCP/IP object no problem. Just struggling with the next step.
An example message is:
STX<FASCr>
<rq>12</rq>
<id>0</id>
<v>0</v>
</FASCr>ETX
I know MATLAB has a xmlwrite function, just wondering how to send that over TCP/IP.
Thanks,
J

 採用された回答

Walter Roberson
Walter Roberson 2015 年 6 月 26 日

1 投票

str = xmlwrite(DOMnode) serializes the DOM node to a string.
Once you have the string then
fprintf(TheSocket, '%c%s%c', 2, str, 3)

その他の回答 (0 件)

カテゴリ

質問済み:

J
J
2015 年 6 月 26 日

回答済み:

2015 年 6 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by