【问题标题】:parallel animation in matlabmatlab中的并行动画
【发布时间】:2014-06-12 20:00:04
【问题描述】:

我正在使用 Matlab 制作带有动画的 GUI,但我有一个问题。我希望动画同时出现在两个情节上,所以我这样做了:

for i = 1:numel(y)
    axes(handles.axes3)
    yspring = linspace(maxy + 1,y(i));
    xspring = ones(1,numel(yspring));
    set(spring, 'XData', xspring, 'YData', yspring);
    set(plummet,'XData', 1, 'YData', y(i));
    set(handles.edit8, 'String', num2str(T(i)));

    axes(handles.axes1)
    set(mark,'XData', T(i), 'YData', y(i));
    speedctrl = get(handles.slider1, 'Value')/10;
    pause(speedctrl)
end

但是使用 axes(h) 很慢,不建议在循环中使用(它会使动画变慢),那么我应该如何重写这段代码来避免这个问题呢? 感谢您的提前。

【问题讨论】:

  • 我找到了解决方案,将 axes(handles.axes1) 替换为 set(handles.figure1, 'CurrentAxes', handles.axes1)
  • 您应该将其发布为答案,这会使您的解决方案在遇到相同问题的随机 Google 员工中脱颖而出 :)

标签: matlab animation


【解决方案1】:

我找到了解决方案,将 axes(handles.axes1) 替换为 set(handles.figure1, 'CurrentAxes', handles.axes1)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-13
    • 2011-11-19
    • 2013-02-02
    相关资源
    最近更新 更多