![]() My second attempt was to follow the Matlab trail, to see exactly what the help function does internally to format parts of the text as bold. So unless I find a way to update the BoldStartTokens attribute values from Matlab, this looked like a dead end. Attempting to remove and add the attribute afresh (with modified values) failed due to a : Illegal cast to MutableAttributeSet Java exception. This means that unlike the SyntaxTokens attribute, which contains an array of Java String objects that can be modified one at a time (this is used by cprintf), the BoldStartTokens attribute value cannot be modified in a similar manner. Unfortunately, this attribute contains an array of integer values, that get converted to a simple numeric array in Matlab. It turns out that in addition to the three custom attributes used by Matlab in past releases, a fourth attribute called BoldStartTokens was added, which stored the relative position index of the bold text within each text element. I stated out investigating the relevant attributes used by the CW’s underlying Java component to display the text. It therefore seemed a reasonable request to add this functionality to cprintf. This is used, for example, when displaying the function name in the output of the help function (i.e., help(‘max’) will display the term ‘max’ in bold when displaying the help section). ![]() Since Matlab release 7.13 (R2011b), the Matlab Command Window (CW) has the ability to display bold text. The comment requested a way to display bold text in the Command Window, similarly to the way that we can display co lo red and underlined text using my cprintf utility. A reader comment last week sent me on a short wild goose chase, that had an interesting and useful conclusion. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |