Convert variable to a title - includes special charcters
显示 更早的评论
I am storing a file name as a variable to be retrieved. But, the name of the file contains underscores. When I use the variable name as the title of my plot each letter that follows an underscore becomes subscripted. What I would like is for the underscores to remain underscores. Example: FileName=SD_Padres_are_great;
Then I plot a chart & I use this as the title: title(FileName);
In the above example the output title would print with the underscores missing and the P a & g subscripted.
Does anyone know how to keep the title in the exact format of the FileName? BTW-I do not have control of the file names to change them as they are created by another program.
采纳的回答
更多回答(1 个)
Guillaume
2015-2-23
title(string_with_underscores, 'Interpreter', 'none')
4 个评论
MathKat
2015-2-23
Guillaume
2015-2-23
Then, you'll have to show the code that you've used. Most likely, you've made a mistake because, as mentioned that's the documented way to solve your issue.
figure;
plot(0:1, 0:1);
title('a_string_with_underscore', 'Interpreter', 'none');
works fine for me.
Note that there are other characters that can give you trouble if you leave the 'Interpreter' as default (the default being 'tex'). Again, read the doc, under the section Named-Value pair argument.
类别
在 帮助中心 和 File Exchange 中查找有关 Title 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!