Weird characters when editing figure

3 次查看(过去 30 天)
Hi. I've recently installed MATLAB R2022a and R2017b on a Windows 10 PC. All seems to work fine, but I get weird characters when editing the title or the axis labels of figures.
I’m attaching screenshots of a simple example to highlight the phenomenon. The aspect of the figure is the usual one: the text is completely legible.
However, when double-clicking in the text for editing it, weird/random characters appear instead of the original text.
I get the same behaviour in both versions of MATLAB and don’t why or how to solve it. Any idea?

回答(2 个)

Constantino Carlos Reyes-Aldasoro
I would suggest that you do not edit the text of figures. The whole idea of using Matlab instead of photoshop/gimp/illustrator is that the whole figure should be created in code. Then, in case you need to modify in the future (and you will in most cases!) you only need to re-run the code. To expand, create a file for the figure, e.g. Fig1.m, and then write there all your steps to generate your desired figure. When finished, just click RUN at the top and the figure should be created. I have written a book about Matlab for image processing and the last chapter is just about how to create publication-quality figures. Have a look:

Alejandro Bustos
Alejandro Bustos 2022-7-11
Thank you very much for the information, but it doesn't solve my problem. I know how to code the text of the figures, but the problem is that the images I want to modify require some time to be generated and it's faster to modify the text directly on them than regenerate the figures everytime I want to make adjustements on the titles.
I guess it must be a codification problem, because it doesn't happen on other computers.
  1 个评论
Constantino Carlos Reyes-Aldasoro
Why don't you add the correct text for every figure in your code? That would certainly be faster than having to click and re-write.
Another way to do this is throught he command line. First grab a handle to the axis:
hAxis = gca;
this grabs the handles and creates and empty figure, then modify the title in the command line:
hAxis.Title.String ='This is figure 1';
And then you can do this without having to click there. Now, one last thing, the text is sometimes interpreted as latex, i.e.
hAxis.Title.String ='This is figure 1 where x^{2}_{1}';
This may be causing you problems if you use symbols that are interpreted in latex, if you do not want that interpretation, use 'interpreter','none':
hAxis.Title.String ='This is figure 1 where x^{2}_{1}';
hAxis.Title.Interpreter = 'none';
Hope this helps solve your problem.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by