1.75

1.8 | 4 ratings Rate this file 3 Downloads (last 30 days) File Size: 1.46 KB File ID: #5969

Fix string for graph title

by Alecsander Eitan

 

01 Oct 2004 (Updated 04 Oct 2004)

This function fixes a string before it is used as a title for a graph.

| Watch this File

File Information
Description

This function fixes a string before it is used as a title for a graph.

It is known that an underscore '_' is used in the title string to set the next character to lowercase. But, in many cases we don't need this feature, we just want to print the underscore. The correct way is to insert the '\_' pair instead of '_'. This function is doing exactly this. It can handle any number of underscores in the string.

EDITOR'S NOTE:
You can also accomplish this by setting a text object's interpreter. For example:
>> title('My_Plot','Interpreter','none')

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
04 Oct 2004 Àî ÑÒ²©  
06 Oct 2004 Jos vdG

Nice programming effort but the function STRREP can already be used for this:
 
mytitle = 'i_want_under_scores' ;
title(strrep(mytitle,'_','\_') ;

20 Oct 2004 puci cu  
15 Feb 2006 Marcelo Lipas

The Editor's Note is the right answer. However, it wouldn't be here if this script was not submited! ;-)

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
annotation Alecsander Eitan 22 Oct 2008 07:32:27
customization Alecsander Eitan 22 Oct 2008 07:32:27
graph title Alecsander Eitan 22 Oct 2008 07:32:27
fix Alecsander Eitan 22 Oct 2008 07:32:27
string Alecsander Eitan 22 Oct 2008 07:32:27
graphics Alecsander Eitan 22 Oct 2008 07:32:27
plot Alecsander Eitan 22 Oct 2008 07:32:27

Contact us at files@mathworks.com