How to insert a variable and datetime array into a graph title?
21 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Brianna Miranda
am 2 Mär. 2022
Kommentiert: Star Strider
am 2 Mär. 2022
I have a graph that I want to include the date&time it was made and the number of data stacks the plot contains on it. The number of stacks is a variable that changes depending on what I input for it. The title for the plot works when I use:
sgtitle([datestr(startTime)]
but I also want to add "Number of stacks: N" to the title.
I have this so far but it isn't working:
sgtitle('Recorded on: ', [datestr(startTime)],'Number of Stacks: ',N)
I want the title to look like this:
Recorded on: dategoeshere, Number of Stacks: N
0 Kommentare
Akzeptierte Antwort
Star Strider
am 2 Mär. 2022
2 Kommentare
Steven Lord
am 2 Mär. 2022
Or perhaps simpler than sprintf:
plot(1:10)
n = 5;
T = datetime('today');
title("This plot with n = " + n + ...
" was generated on " + string(T))
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!