Pass the text of fprintf to the plot's text
11 views (last 30 days)
Show older comments
Would it be possible to pass the text of fprintf to the plot's text?
x = rand(1,10);
plot(x)
m = mean(x);
sd = std(x);
a = fprintf('the mean is %1.2f\n',m);
b = fprintf('the standard deviation is %1.2f\n',sd);
text(2,0.5,[a b])
0 Comments
Accepted Answer
Dyuman Joshi
on 12 Dec 2023
x = rand(1,10);
plot(x)
m = mean(x);
sd = std(x);
a = sprintf('the mean is %1.2f\n',m);
disp(a)
b = sprintf('the standard deviation is %1.2f\n',sd);
disp(b)
text(2,0.5,[a b])
1 Comment
More Answers (0)
See Also
Categories
Find more on Labels and Annotations 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!