Skip to content

Instantly share code, notes, and snippets.

@CodingMinds
Created December 14, 2012 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodingMinds/4288921 to your computer and use it in GitHub Desktop.
Save CodingMinds/4288921 to your computer and use it in GitHub Desktop.
modified scilab socket library functions
prot=funcprot()
funcprot(0)
function mat=SOCKET_read(id)
mat=[];
cmd=["set tclsocketlong 0;";
"set response 0;";
"while {$tclsocketlong >= 0 || $response != 1} {";
"set tclsocketlong [gets $tclsocket"+string(id)+" tclsocketline];";
"if {$tclsocketlong >= 0} {";
"flush $tclsocket"+string(id)+";";
"set response 1;";
"ScilabEval ""mat=\[\""[string map {\"" \""\"" \'' \''\''} $tclsocketline]\"";mat\];""";
"}";
"}"];
TCL_EvalStr(strcat(cmd," "));
endfunction
function mat=SOCKET_query(id,commande)
SOCKET_write(id,commande);
mat=SOCKET_read(id);
endfunction
funcprot(prot)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment