Creating interactive annotation with latex
8 views (last 30 days)
Show older comments
Hi,
I want to add annotation to a histogram which will contain mean, standard deviation and number of sample. I could create a box and write the text using latex but I can't insert the value interactively. Here I am sharing my code as follows.
tpd = dataArray{:, 11}*1e9; mu = mean(tpd); sigma = std(tpd); tpd_median = median(tpd); t = annotation('textbox'); t.Interpreter = 'tex'; str = t.String; i = t.Interpreter; s = t.FontSize; d = t.Position; str.Interpreter = 'Latex'; str_mu = sprintf('\mu = %0.3f',mu) str_sigma = sprintf('\sigma = %0.3f',sigma) t.String = {str_mu,str_sigma}; t.Position = [0.7 0.6 0.18 0.2]; t.FontSize = 12;
The tool is throwing the following errors.
Warning: Struct field assignment overwrites a value with class "cell". See MATLAB R14SP2 Release Notes, Assigning Nonstructure Variables As Structures Displays Warning, for details. > In lvt_mc_1 (line 96) Warning: Control Character '\m' is not valid. See 'doc sprintf' for control characters valid in the format string. > In lvt_mc_1 (line 97)
str_mu =
Empty string: 1-by-0
Warning: Control Character '\s' is not valid. See 'doc sprintf' for control characters valid in the format string. > In lvt_mc_1 (line 98)
str_sigma =
Empty string: 1-by-0
I am using Matlab 2015a.
Please help me to get rid of the issue.
Thanks in advance Saikat Chatterjee
0 Comments
Answers (0)
See Also
Categories
Find more on Data Import and Analysis 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!