MATLAB: Unexpected behaviour of uiimport

MATLABuiimport

Dear all,
my initial task was to import some *.csv file and return the content and the filename as return variables, such as
[content, filenameSelected] = uiimport;
Using R2020b, I receive different GUIs when calling
uiimport
without return variable, which opens the new(?) import wizard or calling
A = uiimport;
which opens an old(?) GUI. None of it, provide the file & path name, selected during the wizard.
Question: is there an option to use the new wizard in combination with a return variable, providing the content and the filename?
(Workaround for the latter would be the use of 'uigetfile' before.)
Thanks

Best Answer

There are two tools that may be used when importing text data. If you specify an output argument when you call uiimport, the Import Wizard is used. When you do not specify an output argument, the Import Tool is used.
The uiimport documentation does also mention about this behaviour.
>> uiimport('txtInput.csv') % Opens the Import Tool
>> s = uiimport('txtInput.csv') % Opens the Import Wizard
The Import Tool was built to handle many more types of files and variations than the Import Wizard. In many cases, it produces better results, and provides many more controls over the output.
The Import Tool will directly create variables in the workspace, or alternatively, the user can generate a script or a function to use in their code to do the import.
Please note that there is no way to enforce or use the Import Tool in synchronous mode like this (i.e combining and retrieving data into an output variable).
Another workaround that I can suggest is using a command line prompt
vars = [];
vars = whos;
uiimport('-file')
% hit enter on the command window after doing the import
input('Hit enter when done importing...')
vars2 = whos;
% newvars has the name of the file that was selected for import
newvars = setdiff({vars2.name},{vars.name})