Variable in title is appearing as random string characters.
Show older comments
Running matlab R2019a
Im creating a mesh plot.
Here is my code for the title:
og_rows = 15360
og_cols = 1024
title(['Form Removed Data ',og_rows, 'x', og_cols])
This is following the matlab guidelines here: https://uk.mathworks.com/help/matlab/ref/title.html
This strangely results in this:

Accepted Answer
More Answers (2)
Walter Roberson
on 4 Sep 2019
title( sprintf('Form Removed Data %d x %d',og_rows, og_cols) )
1 Comment
Joe Pashley
on 4 Sep 2019
Edited: Joe Pashley
on 4 Sep 2019
Steven Lord
on 4 Sep 2019
Another option (instead of str2num or sprintf) is to use string operations.
og_rows = 15360;
og_cols = 1024;
title("Form Removed Data " + og_rows + " x " + og_cols)
1 Comment
Walter Roberson
on 4 Sep 2019
(The above solution requires R2017a or later.)
Categories
Find more on Title in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!