Many changes for 400G DSP
Minimal Example ...
This commit is contained in:
42
projects/HighSpeedExperiment_2024/auswertung/checkDBpaths.m
Normal file
42
projects/HighSpeedExperiment_2024/auswertung/checkDBpaths.m
Normal file
@@ -0,0 +1,42 @@
|
||||
% Load the Runs table from the database
|
||||
db = DBHandler("pathToDB", 'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\silas_labor.db');
|
||||
runsTable = db.queryDB(db.tables, {'Runs.run_id', 'Runs.tx_bits_path', 'Runs.tx_symbols_path', 'Runs.rx_sync_path', 'Runs.rx_raw_path', 'Runs.filename'});
|
||||
|
||||
% Initialize an array to store the result of existence check
|
||||
fileExistenceResults = false(height(runsTable), 4); % 4 columns for the paths: tx_bits, tx_symbols, rx_sync, rx_raw
|
||||
|
||||
% Main file path
|
||||
sioe_labor_path = 'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor';
|
||||
|
||||
% Loop through all rows in the table and check paths
|
||||
for i = 1:height(runsTable)
|
||||
fileExistenceResults(i, 1) = exist([sioe_labor_path, runsTable.tx_bits_path{i}], 'file') == 2;
|
||||
fileExistenceResults(i, 2) = exist([sioe_labor_path, runsTable.tx_symbols_path{i}], 'file') == 2;
|
||||
fileExistenceResults(i, 3) = exist([sioe_labor_path, runsTable.rx_sync_path{i}], 'file') == 2;
|
||||
fileExistenceResults(i, 4) = exist([sioe_labor_path, runsTable.rx_raw_path{i}], 'file') == 2;
|
||||
end
|
||||
|
||||
% Identify corrupted run_ids (where any path does not exist)
|
||||
corruptedRunIds = runsTable.run_id(~all(fileExistenceResults, 2));
|
||||
|
||||
% Delete entries in all tables related to corrupted run_ids
|
||||
for i = 1:numel(corruptedRunIds)
|
||||
run_id = corruptedRunIds(i);
|
||||
|
||||
% Delete from BERs table
|
||||
db.executeSQL(sprintf('DELETE FROM BERs WHERE run_id = %d;', run_id));
|
||||
|
||||
% Delete from Equalizer table (if applicable)
|
||||
db.executeSQL(sprintf('DELETE FROM Equalizer WHERE eq_id IN (SELECT eq_id FROM BERs WHERE run_id = %d);', run_id));
|
||||
|
||||
% Delete from Measurements table
|
||||
db.executeSQL(sprintf('DELETE FROM Measurements WHERE run_id = %d;', run_id));
|
||||
|
||||
% Delete from Configurations table
|
||||
db.executeSQL(sprintf('DELETE FROM Configurations WHERE run_id = %d;', run_id));
|
||||
|
||||
% Delete from Runs table
|
||||
db.executeSQL(sprintf('DELETE FROM Runs WHERE run_id = %d;', run_id));
|
||||
end
|
||||
%
|
||||
% disp('Entries for corrupted run_ids have been removed from the database.');
|
||||
Reference in New Issue
Block a user