Skip to content
Snippets Groups Projects
reloadSoundSourceFile.m 1.42 KiB
function [] = reloadSoundSourceFile(~, ~)
%LOADSOUNDSOURCEFILE Creates a file selection dialog and reads the file into memory.

global artoaDataInput artoaWorkspace artoaConfig;

%% Get required variables
filepath = artoaConfig.files.soundsourcefile;

%% Ask for confirmation
answer = questdlg( ...
        [ ...
            'Reload soundsource file "'...
            filepath ...
            '"?' ...
        ], ...
        'Reload soundsource file?', ...
        'Yes', ...
        'No', ...
        struct('Default', 'Yes', 'Interpreter', 'none') ...
    );

if strcmp(answer, 'No')
    return;
end

if ~isfile(filepath)
    error([mfilename ': Could not reload soundsource file, given file is not available!']);
end

%% Initialize variables
artoaDataInput.soundsources = false;

%% Load file into memory
artoaDataInput.soundsources = artoa.load.soundsources(filepath);

%% GET SOUNDSOURCES THAT ARE ALIVE DURING THE FLOAT MISSION
if isfield(artoaDataInput, 'rfb')
    artoaWorkspace.filteredSoundsources = artoa.soundsources.filter( ...
        artoaDataInput.soundsources, min(artoaWorkspace.rafosDate), max(artoaWorkspace.rafosDate) ...
    );
else % no rfb file loaded, so all are valid
    artoaWorkspace.filteredSoundsources = artoaDataInput.soundsources;
end

%% Update guis
artoa.controller.edit.offsets.updateWorkspaceOffsetsTable(true);
artoa.controller.edit.offsets.updateGui();
artoa.controller.edit.offsets.updateMeasuredSoundspeed();

end