Latex Interpreter MATLAB title underscores
117 次查看(过去 30 天)
显示 更早的评论
Hi there,
I was using this title command as the title of the plot: title(['File:' filename 'Stim electr: 'num2str(StimElectr(n))])
The filename contains underscores that are interpreted as subscripts in my MATLAB 2013b. Turning off the LaTEX interpreter locally seems to work only when I do not include the strings 'File:' and 'Stim electr' in my title command.
In other words, this works fine: title(filename,'interpreter','none') and underscores are kept as they are, but this doesn't: title(['File:' filename, 'interpreter', 'none']).
How can I keep the underscores for my initial title command?? (back slash etc I cannot use coz I cannot change the filename manually each time)
Thanx a lot!! Stelina
0 个评论
采纳的回答
Guillaume
2014-10-10
It looks like you misplaced the closing bracket. The proper command should have been:
title(['File:' filename], 'interpreter', 'none');
As it was you just included your 'interpreter', 'none' instruction in the title of the figure. I would recommend you use sprintf instead of concatenating strings. It makes the intent much clearer and may have helped avoid such error:
title(sprintf('File:%s', filename), 'interpreter', 'none');
2 个评论
Guillaume
2014-10-23
Again, I would recommend sprintf for that:
title(sprintf('File: %s Stim electr: %f', filename, StimElectr(n)), 'interpreter', 'none');
I find this much easier to read.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!