uigetfile filter error with 2025a works fine in 2024b

I use uigetfile to open various types of files for my users mostly txt, but I want to be more specific.
for example
[infile, apploc] = uigetfile('*Stim*.txt', 'Select a Stimulus File',infile);
it pops up fine in 2024b but when I run it in 2025a I get this error and the filter doesn't apply.
Warning: Invalid file filter *Stim*.txt
Does 2025b fix this or must I go back to 2024b?

1 件のコメント

Gavin
Gavin 2025 年 10 月 28 日
Quick update after trying various things at the command line.
uigetfile('*Stim*','Select a Stimulus File')
works, so it no longer can parse after * or figure out a filter that includes an extension?
Also not working
uigetfile({'*stim*';'.txt'},'Select a Stimulus File')
Warning: Invalid file filter *stim*, .txt

サインインしてコメントする。

回答 (1 件)

Akira Agata
Akira Agata 2025 年 10 月 29 日

0 投票

For your purpose, the following syntax is correct and works in both MATLAB version:
[infile, apploc] = uigetfile("*.txt", "Select a Stimulus File", "*Stim*.txt");

5 件のコメント

Gavin
Gavin 2025 年 10 月 29 日
Interesting work around it would be nice if it was documented somewhere that can be found say with "uigetfile filter error"
Gavin
Gavin 2025 年 10 月 29 日
It would be nice if that actually always worked, and was documented somewhere.
In fact what happened is that the dialog never opened and while trying to figure it out MATLAB crashed!
It worked the second time I tried it so OK good for now until my users get the crash.
Gavin
Gavin 2025 年 10 月 31 日
Doesn't do what i wanted that way. I want the existing file to come up as the default and allow user to pick from the right type if they don't want that one. Any chance this bug in ML25 getting fixed?
Walter Roberson
Walter Roberson 2025 年 10 月 31 日
@Gavin By "right type" do you mean that you want the file name to be fixed but the user to have the choice of file extensions? Or do you mean that you want the user to be able to change the file name while keeping the file extension fixed? Or something else?
Gavin
Gavin 2025 年 11 月 4 日
I want the default to be offered so they can just click or press return. The files offered to the user have the particular extension .txt but in addition since there are so many test files in the directory I also filter for files that are the "type" they are looking for. e.g. "*stim*.txt show all the file with stim in the name while "*level*.txt" shows all the levels type files. There are a few different file "types" they need and they don't want them in different directories. Otherwise I could put each type into it's own sub-directory.
It worked fine in versions up to 2024b. Version 2025a broke it.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeApp Building についてさらに検索

製品

リリース

R2025a

質問済み:

2025 年 10 月 28 日

コメント済み:

2025 年 11 月 4 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by