当前位置: 首页 > 有奖问答 >MATLAB 2016a进度条对象获取和设置问题

MATLAB 2016a进度条对象获取和设置问题

作者 tjbbg18
来源: 小木虫 250 5 举报帖子
+关注

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也不能设置颜色了,望指教 返回小木虫查看更多

今日热帖
  • 精华评论
  • 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.

  • 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中如何设置啊,可否告知

  • 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;

  • 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但是我还是不会设置进度条啊

  • FMStation

    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


猜你喜欢
应助之星
下载小木虫APP
与700万科研达人随时交流
  • 二维码
  • IOS
  • 安卓