function [berTable, foundBerFlag] = getBerForRunId(db, run_id) % getBerForRunId Queries the BER data for the specified run_id. % Inputs: % db - The database handler object. % run_id - The run ID for which to get the BER data. % Outputs: % berData - A table containing BER results for the given run ID. % Set up filter parameters to query the BER data for the specific run_id filterParams = db.tables; filterParams.Runs.run_id = run_id; % Filter by specific run_id % Define the fields to be retrieved from the database selectedFields = {'Runs.run_id', 'BERs.ber_id', 'Equalizer.eq_id', 'Equalizer.eq_type', ... 'BERs.ber', 'BERs.occurrence', 'Configurations.db_mode', ... 'Configurations.pam_level', 'Configurations.bitrate', 'Configurations.symbolrate', ... 'Configurations.fiber_length', 'Configurations.wavelength', ... 'Configurations.precomp_amp', 'Measurements.power_rop', 'Measurements.power_laser', ... 'Measurements.power_pd_in'}; % Query the database for the specified run_id [berTable, ~] = db.queryDB(filterParams, selectedFields); if ~isnumeric(berTable.ber) foundBerFlag = ~isnan(str2num(berTable.ber)); else foundBerFlag = 1; end % Display information about the found BER entries % fprintf('Found %d BER entries for run_id %d.\n', size(berTable, 1), run_id); end