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

8 vues (au cours des 30 derniers jours)
Manoj Kumar
Manoj Kumar le 22 Jan 2015
Commenté : Manoj Kumar le 22 Jan 2015
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.

Réponse acceptée

per isakson
per isakson le 22 Jan 2015
Modifié(e) : per isakson le 22 Jan 2015
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.
  2 commentaires
dpb
dpb le 22 Jan 2015
Good catch, missed the '%d'
Manoj Kumar
Manoj Kumar le 22 Jan 2015
Thanks guys...

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by