serial/fprintf of non-string?
Ältere Kommentare anzeigen
The documentation of serial/fprintf shows four possible modes in the representative forms, and in each case the data to be sent is shown as a string. However, the format parameter can include any of many different non-character item specifiers, and one of the examples is
fprintf(s,['ch:%d scale:%d'],[1 20e-3],'sync');
which demonstrates a case where the data to be sent is not a string.
Despite this, a user is reporting to me that in R2013a that they were told
Error using serial/fprintf (line 84)
The third input argument must be a string.
Error in Untitled (line 10)
fprintf(s, '*%d', data(:)) ;
where data is uint8 (obtained via imread)
Unfortunately I cannot test this on my own system as I do not have a serial port. Could someone confirm that non-string data can be used in serial fprintf, and could they test whether uint8 is the problem?
(Assume for the moment that the serial buffer is large enough to hold the entire output; do not test with large arrays as the default output buffer is only 512 bytes.)
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Spreadsheets finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!