MATLAB:更改命令窗口的字体大小

发布于 2025-01-03 09:56:19 字数 462 浏览 2 评论 0原文

我想暂时更改 MATLAB 命令窗口中文本的字体大小。我正在进行一项实验,其中我站在实验室的另一边,需要偶尔从屏幕上读取数字。我不希望所有 MATLAB 输出永远都是巨大的——只是偶尔出现的这个变量。我想一定有一些代码可以增加字体大小?我知道我可以使用以下代码调整例如字体颜色:(

com.mathworks.services.Prefs.setColorPref('ColorsText',java.awt.Color.red);
com.mathworks.services.ColorPrefs.notifyColorListeners('ColorsText');

上面将命令窗口中的文本更改为红色)。应该有类似的代码来设置字体大小吧?

理想的解决方案是向 fprintf 命令添加一个参数,这样只有输出的一位较大。但是,我会接受一种解决方案,其中屏幕的整个输出暂时变大......

任何帮助表示赞赏。

I would like to temporarily change the font size of the text in the command window of MATLAB. I am running an experiment in which I am standing at the other side of the lab, and need to occasionally read a number from the screen. I don't want all the MATLAB output to be jumbo size forever - just this one variable when it occasionally comes up. I expect there must be some code that increases font size? I know I can adjust for example font colour using the following code:

com.mathworks.services.Prefs.setColorPref('ColorsText',java.awt.Color.red);
com.mathworks.services.ColorPrefs.notifyColorListeners('ColorsText');

(The above changes the text in the command window to red). There must be similar code to set font size?

The ideal solution would be a parameter to add to the fprintf command, such that only the one bit of output is larger. However, I would accept a solution in which the entire output of the screen is made larger temporarily...

Any help appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

鼻尖触碰 2025-01-10 09:56:19

在图形中而不是命令行中显示所有输出怎么样?您可以放置​​文本对象并定义颜色和字体大小。

一种方法如下:
“文件 > 首选项 > 字体 > 自定义”,然后设置字体和大小。但它无法从命令行本身访问设置,因此您必须手动设置它,然后禁用它。

编辑:

弹出一个图形并打印出某个变量很容易:

foo = 100;
figure
uid = uicontrol('Style', 'text','String', ['FOO = ' num2str(foo)], 'FontSize', 80, 'ForegroundColor', 'b', 'Units','normalized','Position', [0 0 1 1]); 

如果您愿意,您还可以指定图形窗口本身的位置和大小。
要稍后关闭该图,只需使用:

delete(gcf);

如果您想更新它的值,只需使用类似

set(uid, 'String', 'New text')

What about displaying all output in a figure instead of the command line? You could place text-objects and define colors and font sizes.

One way is the following:
"File > Preferences > Fonts > Custom" and there set your font and size. But it's not accessible setting from the commandline itsel so you would have to set it manually and afterwards disable it.

Edit:

To pop out a figure and print out a certain variable is easy:

foo = 100;
figure
uid = uicontrol('Style', 'text','String', ['FOO = ' num2str(foo)], 'FontSize', 80, 'ForegroundColor', 'b', 'Units','normalized','Position', [0 0 1 1]); 

you could also specify the position and size of the figure window itself, if you want to.
To close the figure later, just use:

delete(gcf);

If you want to update the value of it, just use something like

set(uid, 'String', 'New text')
恏ㄋ傷疤忘ㄋ疼 2025-01-10 09:56:19

主页选项卡 ->环境选项卡 ->首选项->字体

HOME TAB -> ENVIRONMENT TAB -> Preferences -> Fonts

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文