How to get the file name as the title of the figure window?

8 次查看(过去 30 天)
hi,
I have the GUI and I want to get the name of the selected file as the title of the figure window.
[baseFileName,folder]=uigetfile('*'); % read the input image
-
-
-
figure('name',sprintf('file name is %d',baseFileName),'NumberTitle','off');
I tries in this way, but couldn't get the result.
Can any one help me.
Thanks in advance.

采纳的回答

per isakson
per isakson 2015-1-22
编辑:per isakson 2015-1-22
Try to replace
sprintf('file name is %d',baseFileName)
by
sprintf('file name is %s',baseFileName)
Since the value of baseFileName is a character string, %s is the appropriate format specifier.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Title 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by