nass-micro-station-measurem.../slip-ring-test/run_test.m

53 lines
1.1 KiB
Matlab

%%
Tsim = 100; % [s]
%%
tg = slrt;
%% TODO - Build this application if updated
%%
if tg.Connected == "Yes"
if tg.Status == "running"
disp('Target is Running, Stopping...');
tg.stop;
while tg.Status == "running"
pause(1);
end
disp('Target is Stopped');
end
if tg.Status == "stopped"
disp('Load the Application');
tg.load('slip_ring_test');
%% Run the application
disp('Starting the Application');
tg.start;
pause(Tsim);
tg.stop;
end
end
%%
f = SimulinkRealTime.openFTP(tg);
cd(f, 'data/slip_ring_test/');
mget(f, 'data_001.dat', 'data');
close(f);
%%
data = SimulinkRealTime.utils.getFileScopeData('data/data_001.dat').data;
%%
n = 13;
while isfile(['mat/data_', num2str(n, '%03d'), '.mat'])
disp('File exists.');
if input(['Are you sure you want to override the file ', 'mat/data_', ...
num2str(n, '%03d'), '.mat', ' ? [Y/n]']) == 'Y'
break;
end
n = input('What should be the measurement number?');
end
save(['mat/data_', num2str(n, '%03d'), '.mat'], 'data');