[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Real Time plot from C++ data
From: |
rocketsound |
Subject: |
Re: Real Time plot from C++ data |
Date: |
Fri, 5 Jun 2015 15:21:38 -0700 (PDT) |
A quick-'n-dirty way to solve this is to extend your C++ program so that it
writes its messages into a textfile. In Octave you create a infinite loop
and use pause to wait between loop cycles and dir to get file stats of the
log file you're interested. Something like this:
/filepath = 'C:\\my.log';
prevtime = dir(filepath).datenum;
figure;
hold on;
%loopcounter = 0;
while true
currtime = dir('C:\\my.log').datenum;
if currtime > prevtime
prevtime = currtime;
% see http://octave.sourceforge.net/octave/function/textread.html
[n, x, y] = textread(filepath, '%d %f %f');
plot(x(end), y(end));
end
pause(1.0);
% % Uncomment if you want to stop the infinite loop if log file doesn't
change
% loopcounter = loopcounter + 1;
% if(loopcounter > 25)
% break;
% end
end/
Probably there is much better way to solve this but if you don't need a
"customer-ready" solution this might help you. You can cancel the program at
any time via STRG+C or by uncommenting the last lines and the one at the
start of the code.
--
View this message in context:
http://octave.1599824.n4.nabble.com/Real-Time-plot-from-C-data-tp4670673p4670687.html
Sent from the Octave - General mailing list archive at Nabble.com.