Using a text file to title a plot.
显示 更早的评论
I have a program that uses many different data sets to generate plots. In order to keep track of where each plot comes from I would like to pull the data set name out of an associated readme file. The trouble is that I can't seem to figure out how to insert the string I get from the readme. My code gets the string with a simple: label = textread(readme.txt, '%s'), but after getting the label I have not figured out how to successfully insert that label into my plot's title (printing label to the screen shows the desired output). Any suggestions?
采纳的回答
更多回答(2 个)
Rick Rosson
2011-7-13
The title function should work. For example:
figure;
plot(rand(50,1));
label = 'Some Random Numbers';
title(label);
HTH.
Sukuchha
2011-7-13
0 个投票
you can also use like this: header{1} ='label'; header{2} ='x vs y'; title ( header)
类别
在 帮助中心 和 File Exchange 中查找有关 Axis Labels 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!