creating multi-line title with variable values

3 次查看(过去 30 天)
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?

采纳的回答

Stephen23
Stephen23 2016-8-8
编辑:Stephen23 2016-8-8
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 个)

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by