MATLAB: A question about function — uigetfile()

uigetfile

the code
[FileName PathName]=uigetfile(('*.xlsx'), 'Choose a File');
runs Ok; but the code
[FileName PathName]=uigetfile(('*.xlsx','Excel Files(*.xlsx)'; '*.txt','Txt Files(*.txt)'), 'Choose a File');
runs wrongly. why? how should I modify it?

Best Answer

Hi.. Try this code:
[filename, pathname] = uigetfile({'*.xlsx','Excel Files(*.xlsx)'; '*.txt','Txt Files(*.txt)'}, 'Pick a file');
I think it's only missing the {};