Use a temporary variable.
function outFile = fcn()
coder.extrinsic('uigetfile');
[uiselectedFile, pathname, fileindex] = uigetfile('*.dat','Select the DAT input file');
L =length(uiselectedFile)
temp = zeros(1, L, 'uint8');
outFile = temp;
It is not clear to me why you are not emitting the chosen name itself? You do not want to have to prompt the user for it again.
It is also not clear to me why you are not outputting the path.
Also remember that uigetfile() will return numeric 0 if the user cancelled.
And finally... what if the user selects a name that includes characters beyond code position 255?
Best Answer