reading stdin containing newlines in matlab -


stdin can read in matlab using input function demonstrated in this post. instance:

printf "1\t2\n" | matlab -nojvm -nodesktop -nosplash -r "str=input('','s')" 

trying read data multiple newline characters fails because first 1 signals end of input command:

printf "1\t2\n3\t4\n" | matlab -nojvm -nodesktop -nosplash -r "str=input('','s')"   str =  1    2   >>     3    4          |   error: unexpected matlab expression. 

i have tried other possibilities including fscanf(0,...), fscanf('',...), fopen(0,'r'), , fopen('','r'), no avail. wish read lines of tab-separated data piped process, ideally directly cell array, or string can parse myself. of course loop on input until end of stream, wondering whether there not way gather input @ once.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -