24小时热门版块排行榜    

查看: 2192  |  回复: 5
本帖产生 1 个 博学EPI ,点击这里进行查看

tjbbg18

新虫 (小有名气)

[求助] MATLAB 2016a进度条对象获取和设置问题

ha1=get(hrand,'Children');
hac=get(ha1,'Children');
hapa=findall(hac,'Type','patch')
set(hapa,'FaceColor','k')
这个程序在2014a以前都可设置进度条的颜色,我换成MATLAB2016a之后,
hac=get(ha1,'Children');运行显示 0x0 empty GraphicsPlaceholder array.;
而且set也不能设置颜色了,望指教
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

FMStation

至尊木虫 (知名作家)

【答案】应助回帖

https://www.mathworks.com/help/m ... r-some-objects.html

Why Is the Children Property Empty for Some Objects?
Starting in R2014b, these objects do not contain handles to underlying objects in their Children properties. To customize the graph, use properties of the actual object. This table lists the affected objects.
2楼2016-08-25 22:38:26
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

tjbbg18

新虫 (小有名气)

引用回帖:
2楼: Originally posted by FMStation at 2016-08-25 22:38:26
https://www.mathworks.com/help/matlab/graphics_transition/why-is-the-children-property-empty-for-some-objects.html

Why Is the Children Property Empty for Some Objects?
Starting in R2014b, these o ...

这个我也查了,我是想知道在2016a中如何设置啊,可否告知
3楼2016-08-26 21:17:38
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

FMStation

至尊木虫 (知名作家)

【答案】应助回帖

Use colorbar properties to modify the colorbar.
https://www.mathworks.com/help/matlab/ref/colorbar-properties.html
CODE:
c = colorbar;
w = c.LineWidth;
c.LineWidth = 1.5;

4楼2016-08-26 21:32:38
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

tjbbg18

新虫 (小有名气)

引用回帖:
4楼: Originally posted by FMStation at 2016-08-26 21:32:38
Use colorbar properties to modify the colorbar.
https://www.mathworks.com/help/matlab/ref/colorbar-properties.html


c = colorbar;
w = c.LineWidth;
c.LineWidth = 1.5;

hrand=waitbar(0.3,'颜色')
ha1=get(hrand,'Children');
hac=get(ha1,'Children');
hapa=findall(hac,'Type','patch')
set(hapa,'FaceColor','r')
我还是不懂,就是您能否设置一下进度条的颜色hrand=waitbar(0.3,'颜色'),在2016a中,这个程序在2014a以前都可以把进度条颜色设置为红色,但是2016a中帮助文档说是colorbar但是我还是不会设置进度条啊
5楼2016-08-27 11:11:24
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

FMStation

至尊木虫 (知名作家)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★
tjbbg18: 金币+10, 博学EPI+1 2016-08-27 18:15:00
https://stackoverflow.com/questions/36352171/change-width-of-the-bar-figure-at-waitbar-matlab-r2015a
CODE:
% Create a progress bar.
hBar = waitbar ( 0, 'Please Wait....' );
% now use java to get to the progress bar
jFrame = get ( hBar, 'JavaFrame' ); % this will throw a warning
jFigPanel = jFrame.getFigurePanelContainer;
% Now go down through the children of the panel to get the container for the progress bar
jContainer = jFigPanel.getComponent(0);
jPanel = jContainer.getComponent(0);
% Change the location of the panel (ref pixels)
jPanel.setLocation(0,40);
% Change the size of the panel
jPanel.setSize(360,18);
% You then need to repaint and validate for the update to be visible.
jContainer.repaint
jContainer.revalidate

6楼2016-08-27 13:51:58
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 tjbbg18 的主题更新
信息提示
请填处理意见