Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MATLAB - use a string to set the title of a graph

Tags:

matlab

I'm writing a MATLAB program that reads in a title from the user to set on a graph...

t = input('Please enter a title for the graph: ', 's');

I then want to set the title of my plot to t. I can't seem to get it to work...

title(t)    %# returns ??? Index exceeds matrix dimensions.

Many thanks for the help!

like image 976
Mark Avatar asked Feb 20 '10 23:02

Mark


1 Answers

Make sure in your session you have no variable called title masking the title() function

» whos
  Name       Size     Bytes  Class     Attributes

  t          1x1          2  char                
  title      1x1          8  double              <<<<---- you dont want this!
like image 134
Amro Avatar answered Sep 24 '22 01:09

Amro