From 18ef458640b1f3a1cb24ef735615285104c60119 Mon Sep 17 00:00:00 2001 From: earth75 Date: Mon, 17 Jun 2013 17:05:18 +0300 Subject: [PATCH] Create readbyteserial this is quite useful for making matrixes out of serial input, because scilab cant cast strings into matrixes (yet) --- macros/readbyteserial | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 macros/readbyteserial diff --git a/macros/readbyteserial b/macros/readbyteserial new file mode 100644 index 0000000..f4784f5 --- /dev/null +++ b/macros/readbyteserial @@ -0,0 +1,8 @@ +function buf=readserial(h,n) +// 12/1/2009: corrected version after report of bug 3829 + if ~exists("n","local") then + N=serialstatus(h); n=N(1) + end + TCL_EvalStr("binary scan [read "+h+" "+string(n)+"] cu* ttybuf") + buf=evstr(TCL_GetVar("ttybuf"));//returns an array of bytes instead of char, useful since scilab does not want to cast strings into matrixes +endfunction