title according to the file name
37 次查看(过去 30 天)
显示 更早的评论
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 个评论
John Ostrander
2022-3-24
@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.
Rik
2022-3-24
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)
采纳的回答
Constantino Carlos Reyes-Aldasoro
2021-4-15
Perhaps you want to add values to the titles of your figures, try something like this
for k=1:9
subplot(3,3,k)
title(strcat('Subplot number =',num2str(k)))
end
If this does not answer your question, we would need more information.
1 个评论
Adam Danz
2021-4-15
or,
title(['Subplot number = ', num2str(k)])
or,
title(sprintf('Subplot number = %d', k))
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Title 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!