MATLAB: How to send an ASCII code via matlab : fwrite or fprintf

asciirs232

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

Best Answer

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')