Updating object using slider

4 ビュー (過去 30 日間)
yogesh jain
yogesh jain 2016 年 1 月 15 日
回答済み: Walter Roberson 2016 年 1 月 15 日
Hello all , I am updating position of cylinder using slider , But I want to see only updated shape but its showing them all , means all previous ones also . used code under the slider function is -
hold on
[xc,yc,zc] = cylinder(10);
zc(2,:)=30;
ab = surf(yc+x_pos,zc+y_pos,xc+z_pos,'Facecolor','b');
dir=[0 0 1];
rotate(ab,dir,90);
dir=[1 1 0];
hold off
end
where x_pos , y_pos and z_pos updates the position of cylinder.

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 1 月 15 日
You should check the Interruptible and BusyAction properties of the slider object. Sliders often call back multiple times quickly, which could result in calls interrupting each other, interfering with your hold on / hold off logic.
You know that you should be generating your object ahead of time and then your slider should be changing its position coordinates without recreating the object.

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by