MATLAB: Is there a way to use the Import Tool in synchronous mode (uiimport)

asynchronousguiimportMATLABreturnstructsynchronoustooluiimportvariablewizard

Is there a way to use the Import Tool in synchronous mode?

Best Answer

No, there isn't a way to use the Import Tool in synchronous mode. Depending on your workflow, these are suggestions we've provided in the past:
Until we enhanced the situation in the software, please use one of the following workarounds:
1 - Use a command line prompt
vars1 = []; %#ok<NASGU> so vars1 is in the workspace

vars1 = whos;
uiimport('-file')
input('Hit enter when done importing...')
vars2 = whos;
newvars = setdiff({vars2.name},{vars1.name});
2 - Use an uidialog
vars1 = []; %#ok<NASGU> so vars1 is in the workspace
vars1 = whos;
uiimport('readme.txt')
h = helpdlg('Click OK here when done importing');
h.CloseRequestFcn = @(ed, es) f(ed, es, vars1);
h.Children(1).Callback = @(ed, es) f(ed, es, vars1);
function f(es, ed, vars1)
vars2 = evalin('base', 'whos');
newvars = setdiff({vars2.name},{vars1.name});
delete(gcbf); % close the window
% process newvars...
end