Reading console output
32 次查看(过去 30 天)
显示 更早的评论
Does anybody have any idea about how to use console output as input in Matlab under linux? My application continuously returns a value and prints it in integer type to system console. I am seeking for ways to input these values to Matlab and plot versus time.
0 个评论
回答(2 个)
Lorenzo Luengo
2011-7-8
I would try using a fifo (in a console)
mkfifo myfifo
and then running my program from matlab using
system('myprogram > myfifo &');
and then read program output just like a normal file:
h = fopen('myfifo','r')
fscanf(format,...)
in this way you can read your program while it's running, and the fifo works like a buffer, when it's empty the fscanf returns empty variables.
I hope this helps.
0 个评论
Rick Rosson
2011-7-7
You can execute your console application from within the MATLAB Environment by calling the system function from either the MATLAB command line or from within a MATLAB script. The system function can execute your application and will return both a status and any results.
For more information:
>> doc system
HTH.
Rick
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!