How to send an ASCII code via matlab : fwrite or fprintf ?
조회 수: 3 (최근 30일)
이전 댓글 표시
How to send an ASCII code via matlab : fwrite or fprintf ? For example the code 'A30005". Do I need to add something like %s : fprintf(com1,'%s","A30005') Best regards Stanislas
댓글 수: 0
채택된 답변
Walter Roberson
2013년 1월 18일
You an use either call. fprintf() like Thorsten shows, or
fwrite(com1, 'A30005')
If you need to send a terminator (CR or LF) then fprintf() is usually easier
fprintf(com1, '%s\n', 'A30005')
댓글 수: 4
Walter Roberson
2013년 1월 21일
If you use %s\n as your fprintf() format, then the U+000A will automatically be sent. The \n means to send the linefeed, which is U+000A
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!