write superscript in string

6 views (last 30 days)
Hello all,
I'm trying to show my R squared as a title but i wan 2 to be as a superscript not just R2. Here's my inputs:
R2 = 0.75;
t = sprintf('R^2 = %0.2f',R2);
this gives me
t = 'R2 = 0.75'
but what I want is R superscript 2.
azarang asadi
azarang asadi on 1 Jun 2022
it didn't work, maybe it's my release? it's 2020b

Sign in to comment.

Accepted Answer

the cyclist
the cyclist on 31 May 2022
Edited: the cyclist on 31 May 2022
It could be the interpreter. Does this work for you?
R2 = 0.75;
t = sprintf('R^2 = %0.2f',R2);
Also, it might be relevant to know what this returns for you:

More Answers (0)




Community Treasure Hunt

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

Start Hunting!

Translated by