From: Samuel on 20 Jul 2010 17:36 Hi, I am trying to use a file name as a title for a set of axes. The code I am using looks like this: set(get(gca,'Title'),'String',file_name); where file_name is a variable containing, well, the name of a file. the problem is that the file name contains underscore characters, which are interpreted as signaling subscripts, so the axes title has little subscript characters instead of underscores. is there a way to disable this somehow? or am I resigned to having to code a find/replace for _ into \_ ?
From: dpb on 20 Jul 2010 17:42 Samuel wrote: > Hi, > > I am trying to use a file name as a title for a set of axes. The code I > am using looks like this: > > set(get(gca,'Title'),'String',file_name); > > where file_name is a variable containing, well, the name of a file. > > the problem is that the file name contains underscore characters, which > are interpreted as signaling subscripts, so the axes title has little > subscript characters instead of underscores. is there a way to disable > this somehow? or am I resigned to having to code a find/replace for _ > into \_ ? That's easy enough... set(get(gca,'Title'),'String',strrep(file_name,'_','\_')); Question--- what's wrong w/ title() instead since using gca, anyway? --
From: dpb on 20 Jul 2010 17:59 Samuel wrote: > Hi, > > I am trying to use a file name as a title for a set of axes. The code I > am using looks like this: > > set(get(gca,'Title'),'String',file_name); > > where file_name is a variable containing, well, the name of a file. > > the problem is that the file name contains underscore characters, which > are interpreted as signaling subscripts, so the axes title has little > subscript characters instead of underscores. is there a way to disable > this somehow? ... OK, alternatively... h = title,file_name); set(h,'interpreter','none') Of course, this disables all tex interpretation so any other enhancement would be lost if there were any. Granted, not likely in a filename but as a general rule. --
From: Samuel on 20 Jul 2010 19:55 Hah I did not know that title() existed! Thanks for the pointer. dpb <none(a)non.net> wrote in message <i255di$l8v$1(a)news.eternal-september.org>... > Samuel wrote: > > Hi, > > > > I am trying to use a file name as a title for a set of axes. The code I > > am using looks like this: > > > > set(get(gca,'Title'),'String',file_name); > > > > where file_name is a variable containing, well, the name of a file. > > > > the problem is that the file name contains underscore characters, which > > are interpreted as signaling subscripts, so the axes title has little > > subscript characters instead of underscores. is there a way to disable > > this somehow? or am I resigned to having to code a find/replace for _ > > into \_ ? > > That's easy enough... > > set(get(gca,'Title'),'String',strrep(file_name,'_','\_')); > > Question--- > > what's wrong w/ title() instead since using gca, anyway? > > --
|
Pages: 1 Prev: Exporting C program to simulink Next: how to edit xml file |