MATLAB: Does uigetfile return a different data type for filename depending upon the number of files selected

I simply want to determine the number of files that were selected with the uigetfile function.
size(filename) doesn't work.
The size function returns 1 2 when there are two files and 1 129 when there is a single file. I assume that uigetfile returns an array of strings when there are multiple files and a cell array when there is just one file selected.
Why does MATLAB do this, and how do I fix it?
I have tried variations of iscell, iscellstr, ischar to determine what data type of the single-file filename.
I have tried various ways of concatenation including sprintf,char,str, …
Related complaint: The MATLAB documentation doesn't list uigetfile under Data and File Management. You have to hunt it down or already know what it is called.

Best Answer

Why? "Because" is the only answer that matters. It is documented behavior.
While it is something of a pit(proverbial)a(ppendage) I agree, it's not too tough to deal with. I generally write sotoo when using 'MultiSelect','on' --
[files,path,...]=uigetfile('*.m','multiselect','on');
if isfloat(files), error('No files selected'),end
% Clean up return string if only one file; figment from 'multiselect'
if isstr(files), files={files}; end % convert char string to cellstr
for n = 1:length(files)
...
Simply converting in case there is only one before doing anything else means you always are dealing after that point with a cell array and so length functions as expected.
I agree they ( ui[get|put]file) should be at least cross-referenced under file I/O functions; however, since it's a GUI-based control TMW has placed them under the GUI-related stuff instead.
The old standby help is good for finding stuff like this if you aren't sure--start with it alone then look at the subject areas that seem promising. There's also lookfor that searches the comment content for keywords that can locate things if can get a reasonable key word.
Name explosion is a real issue w/ MATLAB however, granted...