You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.7 KiB
47 lines
1.7 KiB
% Download Data - Johannes Ziegmann, Johannes.Ziegmann@thi.de |
|
|
|
restoredefaultpath; |
|
clear; close all; clc; |
|
|
|
fprintf('=============== START DOWNLOADING ===============\n') |
|
fprintf('Available Setup ID`s:\n') |
|
|
|
options = weboptions('Timeout', 3000); |
|
URL = 'https://driver-observer.thi.de/retrieve_arbitrary_sql.php?auth=Qnb7jfeGZM&'; |
|
SQL_var = 'sql=SELECT%20DISTINCT%20`setup_id`%20FROM%20`computeddata`'; % |
|
data_id = webread([URL SQL_var], options); |
|
fprintf('SetupID: %05d\n',data_id.setup_id) |
|
|
|
% Get computed Data |
|
setup_ID = input('Enter the Setup ID for downloading: '); |
|
|
|
%% Download |
|
options = weboptions('Timeout', 3000); |
|
URL = 'https://driver-observer.thi.de/retrieve_arbitrary_sql.php?auth=Qnb7jfeGZM&'; |
|
|
|
SQL_var = ['sql=SELECT%20*%20FROM%20`computeddata`%20WHERE%20`setup_id`='... |
|
num2str(setup_ID) '%20AND%20id=1']; % |
|
data_var = webread([URL SQL_var], options); |
|
data_varN = data_var.Properties.VariableNames; |
|
|
|
chunksize = 100; |
|
nchunks = ceil(width(data_var) / chunksize); |
|
for n = 1:nchunks |
|
from = (n-1) * chunksize + 1; |
|
to = min(n * chunksize, width(data_var)); |
|
|
|
SQL_cudata = ['sql=SELECT%20' strjoin(strcat({'`'},data_varN(from:to),{'`'}),','),... |
|
'%20FROM%20`computeddata`%20WHERE%20`setup_id`='... |
|
num2str(setup_ID) '%20order%20by%20`distance`%20ASC']; |
|
if n>1 |
|
Tinp_raw = [Tinp_raw, webread([URL SQL_cudata], options)]; |
|
else |
|
Tinp_raw = webread([URL SQL_cudata], options); |
|
end |
|
end |
|
|
|
% Tabellen-Metadaten (Tinp.Properties.UserData) |
|
Tinp_raw.Properties.UserData = download_userdata(setup_ID); |
|
|
|
% Spalten-Beschreibungen und Einheiten |
|
Tinp = retrieve_descriptions(Tinp_raw); |