【问题标题】:matlab show the figure and update the text of the uicontrolmatlab显示图形并更新uicontrol的文本
【发布时间】:2012-06-05 15:11:16
【问题描述】:

6 小时后,我解决了我的问题! :]

this was my question:

请帮帮我:调用函数'GUI_400'时如何显示图形?

另外,我希望用 1 到 100 之间的数字更新“S.ty”的文本。 为此,我调用了“test”函数并更新了 s.ty 的 uicontrol。

换句话说,显示图形,只用数字“1”更新“S.ty”的文本,然后更新“2”的数字……直到 100。

在我的代码中,该图在“测试”函数结束时显示,这就是为什么该图将仅显示数字“100”。

【问题讨论】:

  • 也许您需要一些延迟?它可能会显示每个数字,只是太快而无法看到每个数字。
  • @kevlar1818,我不认为我想要延迟:/我更喜欢其他解决方案。谢谢:]

标签: matlab figure matlab-figure


【解决方案1】:
function [] = GUI_400()

    hFig = figure('units','pixels',...
        'position',[300 300 424 430],...
        'menubar','none',...
        'name','GUI_3',...
        'numbertitle','off',...
        'resize','off');        

        Im = imread('0.png');
        hAxes = axes('Parent',hFig,'Units','pixels','Position',[0 72 424 359]);  %#   so the position is easy to define
        image(Im,'Parent',hAxes);  %# Plot the image
        set(hAxes,'Visible','off', 'handlevisibility', 'off');          %# Turn the axes visibility off

        S.tx = uicontrol('style','text',...
         'unit','pix',...
         'position',[0 32 424 40],...
         'string','מכין תמונה 1 מתוך 3',...
         'backgroundcolor','r',...
         'fontsize',23);
        mystr = 'alon';
         temp = uicontrol('style','text',...
         'unit','pix',...
         'position',[0 0 424 40],...
         'string',mystr,...
         'backgroundcolor','r',...
         'fontsize',23);

   for i = 1:1000
        set(temp,'string',num2str(i));
       drawnow;
   end
end

【讨论】:

    猜你喜欢
    • 2014-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-06
    • 2014-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多