title according to the file name
Ältere Kommentare anzeigen
Does anybody know how to (in a plot) put the ‘title’ as the name of the file where the X,Y,Z variables are included? the idea is to generate several and independent plots, based on ‘imagesc’, ‘contolchart’ and other plotting functions. Thanks.
4 Kommentare
Rik
am 15 Apr. 2021
If you have the file name available as a char or string, you can use it in the title function call. Otherwise I don't know what you would mean.
Fercho_Sala
am 15 Apr. 2021
John Ostrander
am 24 Mär. 2022
@Rik I am looking for something similar. There is a python code for it (I am learning both and very much a newbie) but in my case and I suspect the qeustion is the same:
C:\path\morepath\.......\filename.csv some of my files are buried deep in the file structure.
Strip "filename" from this automatically and insert it as the graph title.
I work with many files, and many graphs look alike. This would save time.
The fileparts function should do what you need:
[p,f,e]=fileparts('C:\path\morepath\filename.csv')
%(these results are on Linux, on Windows you should get this)
Akzeptierte Antwort
Weitere Antworten (1)
Kategorien
Mehr zu Annotations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!