Updating the plot problem while using refreshdata
Show older comments
Hi!! I was having a problem on my code while using the refreshdata, and I was hoping for your help. I want to see the actual first peak and valley from my data, then update the plot after passing them until i reach the last value in my data. I tried first to just run the whole data, but I am already stuck with it and just keep getting the whole data, and was fast too. I was actually planning to use it for the succeeding codes that I already have and for a real-time signal analysis.
I am not used to Matlab coding too so bear with me please.
Here is the code I made
%raw data from XYZ direction
NormChest = readtable('Tidal/TV_500ml.csv'); %%%get the raw data
C = table2array(NormChest(:,1));
x = table2array(NormChest(:,2));
y = table2array(NormChest(:,4));
z = table2array(NormChest(:,6));
total = table2array(NormChest(:,8));
time = C(:,1);
%--------------------------------------------------------------------------
% get relative acceleration
x = x - mean(x);
y = y - mean(y);
z = z - mean(z);
total = total - mean(total);
% % plot for raw data
% figure (1)
% plot (time, x, time, y, time, z, time, total), legend('x','y','z','total'); axis tight;
% title ("Subject 1 (500 mL)")
%--------------------------------------------------------------------------
%partial delay %Still having difficulty here
x1 = time; %trial
y1 = z; %trial
h = plot (x1, y1);
h.XDataSource = 'x1';
h.YDataSource = 'y1';
for i = 0:20
refreshdata (h, 'caller');
drawnow;
end
%
%
% for i = 1:1:numel (time)
%
% % refreshdata;
% end
Accepted Answer
More Answers (0)
Categories
Find more on Animation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!