필터 지우기
필터 지우기

Write both strings and binary data to a TCP/IP object?

조회 수: 1 (최근 30일)
Kevin Bachovchin
Kevin Bachovchin 2014년 6월 5일
편집: José-Luis 2014년 6월 6일
Hello,
Is it possible to write both strings and binary data to a TCP/IP object? I know you can write strings using fprintf and binary data using fwrite. Is it possible to do both (ie, something like one column with variable names and the next column with numeric values)?
Thank you,
Kevin
  댓글 수: 3
Kevin Bachovchin
Kevin Bachovchin 2014년 6월 6일
I think it's different for writing to a file vs. writing to a TCP/IP object. For example, the fprintf command works differently when writing to a file vs. when writing a TCP/IP object
vs.
José-Luis
José-Luis 2014년 6월 6일
편집: José-Luis 2014년 6월 6일
I don't have the instrument control toolbox, nor wouldn't I know how to use it. But just from looking at the documentation:
obj = tcpip('rhost');
s = 'Lookee, Ima string';
d = pi();
string_to_pass = [s ' ' num2str(d)];
fprintf(obj,string_to_pass)
Which might be totally idiotic, but your question seems to reduce to how can I put number and strings together. That was answered in the question you asked before.

댓글을 달려면 로그인하십시오.

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by