tg = slrt; %% if tg.Connected == "Yes" if tg.Status == "stopped" %% Load the application tg.load('test_cercalo'); %% Run the application tg.start; pause(101); tg.stop; end end %% f = SimulinkRealTime.openFTP(tg); mget(f, 'data/data_001.dat'); close(f); %% Convert the Data data = SimulinkRealTime.utils.getFileScopeData('data/data_001.dat').data; t = data(:, end); uh = data(:, 1); % Voltage sent to cercalo in horizontal direction uv = data(:, 2); % [...] in vertical direction xh = data(:, 3); % Measured horizontal position of the beam by the 4QD xv = data(:, 4); % [...] vertical position cuh = data(:, 5); % Voltage of the cercalo's inductors used for horizontal cuv = data(:, 6); % [...] vertical %% Plot the data figure; hold on; plot(t, uh, 'DisplayName', 'uh'); plot(t, uv, 'DisplayName', 'uv'); hold off xlabel('Time [s]'); ylabel('Voltage [V]'); legend(); figure; hold on; plot(t, xh, 'DisplayName', 'xh'); plot(t, xv, 'DisplayName', 'xv'); hold off xlabel('Time [s]'); ylabel('Voltage [V]'); legend(); figure; hold on; plot(t, cuh, 'DisplayName', 'Cuh'); plot(t, cuv, 'DisplayName', 'Cuv'); hold off xlabel('Time [s]'); ylabel('Voltage [V]'); legend(); %% Save save('mat/data_uh.mat', 't', 'uh', 'uv', 'xh', 'xv', 'cuh', 'cuv');