function saveSettings() % Controls we need to save are 'edit', 'checkbox', 'radio' % so go through all of them and save them in a cell array with the tag and % the value or string f = findobj('Tag', 'clustetring_main_f'); %Edit buttons txt = findall(f, 'Style', 'edit'); chk = findall(f, 'Style', 'checkbox'); rad = findall(f, 'Style', 'radiobutton'); controls = [txt; chk; rad]; data = struct(); for i=1:numel(controls) data(i).tag = controls(i).Tag; data(i).string = controls(i).String; data(i).value = controls(i).Value; data(i).visible = controls(i).Visible; end % Save this somewhere [FileName,PathName,FilterIndex] = uiputfile('settings.m','Save Settings'); save([PathName FileName],'data'); end