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"
|
if tg.Status == "stopped"
|
||||||
disp('Load the Application');
|
disp('Load the Application');
|
||||||
tg.load('measure_channels');
|
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
|
%% Run the application
|
||||||
disp('Starting the Application');
|
disp('Starting the Application');
|
||||||
tg.start;
|
tg.start;
|
||||||
pause(Tsim);
|
pause(Tsim);
|
||||||
tg.stop;
|
tg.stop;
|
||||||
end
|
|
||||||
else
|
|
||||||
error("The target computer is not connected");
|
|
||||||
end
|
|
||||||
|
|
||||||
%%
|
%% Get the data from the speedgoat
|
||||||
f = SimulinkRealTime.openFTP(tg);
|
f = SimulinkRealTime.openFTP(tg);
|
||||||
cd(f, 'data/measure_channels/');
|
cd(f, 'data/measure_channels/');
|
||||||
mget(f, 'data_001.dat', 'data');
|
mget(f, 'data_001.dat', 'data');
|
||||||
close(f);
|
close(f);
|
||||||
|
|
||||||
|
% Convert the data to a Matlab object
|
||||||
data = SimulinkRealTime.utils.getFileScopeData('data/data_001.dat').data;
|
data = SimulinkRealTime.utils.getFileScopeData('data/data_001.dat').data;
|
||||||
|
|
||||||
%%
|
%% Save the new data into one mat file
|
||||||
n = 52;
|
save(['mat/data_', date_str, '.mat'], 'data');
|
||||||
|
else
|
||||||
while isfile(['mat/data_', num2str(n, '%03d'), '.mat'])
|
error("The target computer is running");
|
||||||
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
|
end
|
||||||
n = input('What should be the measurement number?');
|
else
|
||||||
|
error("The target computer is not connected");
|
||||||
end
|
end
|
||||||
|
|
||||||
save(['mat/data_', num2str(n, '%03d'), '.mat'], 'data');
|
|
||||||
|
Loading…
Reference in New Issue
Block a user