Change the matlab file name to include the date in the filename
This commit is contained in:
parent
7ae17e7a60
commit
299c7336df
@ -19,35 +19,32 @@ if tg.Connected == "Yes"
|
||||
if tg.Status == "stopped"
|
||||
disp('Load the Application');
|
||||
tg.load('measure_channels');
|
||||
%% Get the current date for the filename
|
||||
% Get the current date and time
|
||||
date_str = erase(cellstr(num2str(clock')), ' ');
|
||||
% Don't take the seconds and add some "_"
|
||||
date_str = strjoin(date_str(1:5), '_');
|
||||
|
||||
%% Run the application
|
||||
disp('Starting the Application');
|
||||
tg.start;
|
||||
pause(Tsim);
|
||||
tg.stop;
|
||||
end
|
||||
else
|
||||
error("The target computer is not connected");
|
||||
end
|
||||
|
||||
%%
|
||||
%% Get the data from the speedgoat
|
||||
f = SimulinkRealTime.openFTP(tg);
|
||||
cd(f, 'data/measure_channels/');
|
||||
mget(f, 'data_001.dat', 'data');
|
||||
close(f);
|
||||
|
||||
% Convert the data to a Matlab object
|
||||
data = SimulinkRealTime.utils.getFileScopeData('data/data_001.dat').data;
|
||||
|
||||
%%
|
||||
n = 52;
|
||||
|
||||
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;
|
||||
%% Save the new data into one mat file
|
||||
save(['mat/data_', date_str, '.mat'], 'data');
|
||||
else
|
||||
error("The target computer is running");
|
||||
end
|
||||
n = input('What should be the measurement number?');
|
||||
else
|
||||
error("The target computer is not connected");
|
||||
end
|
||||
|
||||
save(['mat/data_', num2str(n, '%03d'), '.mat'], 'data');
|
||||
|
Loading…
Reference in New Issue
Block a user