Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有个问题。我正在使用 Matlab。我使用 uigetfile 并在用户选择文本文件后,我想在消息框中显示文件名(并且没有路径名)。我怎样才能做到这一点?这是我的代码示例。
[HMF,HMP,HML] = uigetfile(('*.txt', 'Please select your data'); if HML>0; msgbox([You selected 'bla3']) <- I know this isn't correct) else return;
您将文件名作为uigetfile. 因此,您需要做的就是:
uigetfile
[HMF,HMP,HML] = uigetfile(('*.txt', 'Please select your data'); if HML>0; msgbox(sprintf('You selected %s',HMF)) else return; end