%%
tg = slrt;

f = SimulinkRealTime.openFTP(tg);
mget(f, 'data/data.dat');
close(f);

%% Convert the Data
data = SimulinkRealTime.utils.getFileScopeData('data/data.dat').data;

V = data(:, 1);
d = data(:, 2)*1000e-6/3.333;
t = data(:, end);

%% Save
save('mat/stroke_apa_1stacks_2.mat', 't', 'V', 'd');

%%
d = d - mean(d(t > 1.9 & t < 2.0));

figure;
plot(t, d)

figure;
plot(V, d)
