hey assistent I have this set(get(hAxes(iAxes), 'title'), 'String', regexprep(sTitle,…
- User
hey assistent I have this set(get(hAxes(iAxes), 'title'), 'String', regexprep(sTitle, '_', ' '), 'Tag', 'labels'); that sets the title of my current figure. The problem is if the user manually double clicks on the title, it enters a manually writing over it. If the code wants to update the name, it can't becouse is stuck in manual writing
- Assistant
The issue you're experiencing is related to MATLAB's behavior when it allows interactive editing of axis titles. When a user double-clicks a title (or other text elements like labels), MATLAB allows them to edit the text manually. Once manually edited, programmatically updating the title's
Stringproperty doesn't work unless the title is reset.One way to handle this issue is to disable the interactive editing of the title. You can achieve this by setting the
HitTestandPickablePartsproperties of the title to prevent user interaction. Here’s how you can do it:% Assuming hAxes is your current axes handle hTitle = get(hAxes(iAxes), 'title'); set(hTitle, 'String', regexprep(sTitle, '_', ' '), 'Tag', 'labels'); % Disable interactive editing set(hTitle, 'HitTest', 'off', 'PickableParts', 'none');By setting
'HitTest'to'off'and'PickableParts'to , you effectively disable any mouse interactions with the title text, including double-clicking for manual editing.