53 lines
2.6 KiB
Matlab
53 lines
2.6 KiB
Matlab
function createConfigMenu(DBHandler)
|
|
% Create the main figure window
|
|
fig = uifigure('Name', 'Configuration Query', 'Position', [100, 100, 400, 300]);
|
|
|
|
% Retrieve tables and table names using the DBHandler class
|
|
dbTables = DBHandler.getTables();
|
|
tableNames = DBHandler.getTableNames();
|
|
|
|
% Assume that the DBHandler class provides methods to get the unique
|
|
% configuration options (e.g., PAM levels, bitrates, etc.)
|
|
uniqueBitrates = unique([dbTables.bitrate]);
|
|
uniquePAMLevels = unique([dbTables.pam_level]);
|
|
uniqueWavelengths = unique([dbTables.wavelength]);
|
|
uniqueDBModes = unique([dbTables.db_mode]);
|
|
|
|
% Create dropdown menus for each configuration
|
|
lblBitrate = uilabel(fig, 'Text', 'Bitrate:', 'Position', [50, 240, 100, 20]);
|
|
dropdownBitrate = uidropdown(fig, 'Items', string(uniqueBitrates), 'Position', [150, 240, 200, 20]);
|
|
|
|
lblPAM = uilabel(fig, 'Text', 'PAM Level:', 'Position', [50, 200, 100, 20]);
|
|
dropdownPAM = uidropdown(fig, 'Items', string(uniquePAMLevels), 'Position', [150, 200, 200, 20]);
|
|
|
|
lblWavelength = uilabel(fig, 'Text', 'Wavelength:', 'Position', [50, 160, 100, 20]);
|
|
dropdownWavelength = uidropdown(fig, 'Items', string(uniqueWavelengths), 'Position', [150, 160, 200, 20]);
|
|
|
|
lblDBMode = uilabel(fig, 'Text', 'DB Mode:', 'Position', [50, 120, 100, 20]);
|
|
dropdownDBMode = uidropdown(fig, 'Items', string(uniqueDBModes), 'Position', [150, 120, 200, 20]);
|
|
|
|
% Create a button to query the configuration
|
|
btnQuery = uibutton(fig, 'Text', 'Query Configuration', 'Position', [150, 80, 200, 30], ...
|
|
'ButtonPushedFcn', @(btn, event) queryConfiguration(DBHandler, ...
|
|
dropdownBitrate.Value, ...
|
|
dropdownPAM.Value, ...
|
|
dropdownWavelength.Value, ...
|
|
dropdownDBMode.Value));
|
|
|
|
% Function to handle querying the configuration
|
|
function queryConfiguration(DBHandler, bitrate, pamLevel, wavelength, dbMode)
|
|
% Convert dropdown values to numeric if necessary
|
|
bitrate = str2double(bitrate);
|
|
pamLevel = str2double(pamLevel);
|
|
wavelength = str2double(wavelength);
|
|
dbMode = str2double(dbMode);
|
|
|
|
% Query the DBHandler class with the specified configuration
|
|
results = DBHandler.query(bitrate, pamLevel, wavelength, dbMode);
|
|
|
|
% Display the results in the command window (or update the GUI)
|
|
disp('Query Results:');
|
|
disp(results);
|
|
end
|
|
end
|