Clear Filters
Clear Filters

creating multi-line title with variable values

4 views (last 30 days)
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?

Accepted Answer

Stephen23 on 8 Aug 2016
Edited: Stephen23 on 8 Aug 2016
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)
Or, if you really wish to use a cell array:
C = {'ERROR (m)',sprintf('doy: %d',doy),['igs: ',igs]};

More Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!