MATLAB: Combining LaTeX characters with data formatting in axes title -
i'm trying figure out if there way me combine symbols via tex interpreter , data inputs single string axes title.
for example, current code goes this:
figure axhandle = axes; appletrees = 4; s = sprintf( ... 'apples vs acres\nnumber of apples trees $\alpha = %2.0f$', appletrees); title(axhandle,s,'interpreter','latex')
i understand doesn't work, think conveys trying do.
sprintf causes following message:
warning: control character '\l' not valid. see 'doc sprintf' control characters valid in format string.
i can ditch sprintf , go quotes, lose data formatting / text formatting capability.
the backslash \
special character when formatting strings functions in matlab. sprintf
1 of those. write backslash, use \\
instead. here list of other special characters , how can written.
in case, use following lines:
s = sprintf( ... 'apples vs acres\nnumber of apples trees $\\alpha = %2.0f$', appletrees);
Comments
Post a Comment