% Define input parameters for the DataStorage2 inputParams.L = [1, 2, 10, 80]; % Length in kilometers inputParams.D = [16, 17, 18]; % Diameter in millimeters % Create a DataStorage2 instance with the input parameters dataStorage = DataStorage2(inputParams); % Using DataStorage2 class % Display the current information about the data storage structure dataStorage.showInfo(); % Add a storage variable named 'testStorage' dataStorage.addStorage('testStorage'); % Add a value (e.g., 100) to the storage at specific physical parameter values % For example, we store the value 100 at L = 10 km and D = 17 mm dataStorage.addValueToStorage(100, 'testStorage', 10, 16); dataStorage.addValueToStorage(100, 'testStorage', 10, 17); dataStorage.addValueToStorage(100, 'testStorage', 10, 18); % Retrieve the value from the storage at the same physical parameter values storedValue = dataStorage.getStoValue('testStorage', 10, 16:18); disp('Retrieved value from storage:'); disp(storedValue); % Retrieve another value at a non-existent location (L = 2 km, D = 8 mm) % This will show how the function handles empty storage entries nonExistentValue = dataStorage.getStoValue('testStorage', 2, 8); disp('Retrieved value from empty location:'); disp(nonExistentValue); % Use the internal mappings to check how physical values map to indices % Get the linear index for physical values L = 10 km and D = 17 mm lin_idx = dataStorage.getIndicesByPhys(10, 17); disp('Linear index for L=10 km and D=17 mm:'); disp(lin_idx); % Check the reverse mapping: physical value for index 2 of parameter L physValForIndex = dataStorage.parameter.L.getPhysForIndex(2); disp('Physical value for index 2 of parameter L:'); disp(physValForIndex); % Check the mapping: index for physical value D = 21 mm indexForPhys = dataStorage.parameter.D.getIndexByPhys(21); disp('Index for physical value D=21 mm:'); disp(indexForPhys);