variable color-text for "imtext" function...

2 views (last 30 days)
Hayder
Hayder on 4 Aug 2013
I have used the "imtext" function successfully to display any string of text within an image. Here is a successful example for displaying the text "mean" at location (x,y) = (0.25,0.75) using a specific RGB color for the text "mean":
imtext(0.25,0.75,'\color[rgb]{0.5 0.25 0.1} mean');
Now let's assume that I have a vector: rgb_vector = [0.5 0.25 0.1]
If I try the following command, it fails to work:
imtext(0.25,0.75,'\color[rgb]{rgb_vector} mean');
I have tried to convert rgb_vector to string using "num2str" and "mat2str" but both failed to work. I also tried to convert the vector to a cell array using num2cell and mat2cell, but none of these solutions worked either.
Here are typical warning/error messages that I get:
{
Unable to interpret TeX string "\color[rgb]{rgb_vector} mean"
Unable to interpret TeX string "\color[rgb]{num2str(rgb_vector)} mean"
Unable to interpret TeX string "\color[rgb]{mat2str(vec)} mean"
Unable to interpret TeX string "\color[rgb]{num2cell(rgb_vector)} mean"
Unable to interpret TeX string "\color[rgb]{mat2cell(rgb_vector)} mean"
}
Would appreciate any solution that someone may have!
Thanks;

Answers (0)

Categories

Find more on Characters and Strings in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!