MATLAB Answers

0

creating multi-line title with variable values

Asked by sermet on 8 Aug 2016
Latest activity Edited by Stephen Cobeldick on 8 Aug 2016
doy=100; %double
igs=abcd; %string
title({'ERROR (m)';'doy:';'igs:'})
How can I write "doy" variable (100) and "igs" variable (abcd) right near the 'doy:' and 'igs:' on the title?

  0 Comments

Sign in to comment.

Tags

1 Answer

Answer by Stephen Cobeldick on 8 Aug 2016
Edited by Stephen Cobeldick on 8 Aug 2016
 Accepted Answer

You can also make a multiline title by constructing a string with newline charcters. This is trivial to construct using sprintf and the arguments:
txt = sprintf('ERROR (m)\ndoy: %d\nigs: %s',doy,igs)
title(txt)
Or, if you really wish to use a cell array:
C = {'ERROR (m)',sprintf('doy: %d',doy),['igs: ',igs]};
title(C)

  0 Comments

Sign in to comment.