필터 지우기
필터 지우기

refreshdata, drawnow, ... nothing works?

조회 수: 9 (최근 30일)
Vinci
Vinci 2013년 10월 28일
답변: Vinci 2013년 10월 29일
Good evening
I'm currently working on a project where data from an embedded platform is fed into matlab in a loop. Some stuff gets calculated and plotted with the drawVector3d function from the famous geom3d lib (<http://www.mathworks.com/matlabcentral/fileexchange/24484-geom3d)>. It's basically just a nicer wrap for quiver3, but it makes my code way more readable...
The code with the actual plot looks like this:
if true
drawVector3d([0 0 0],R(1,:));
drawVector3d([0 0 0],R(2,:));
drawVector3d([0 0 0],R(3,:));
axis vis3d
axis([-1 1 -1 1 -1 1])
set(gca, 'YDir', 'reverse')
set(gca, 'ZDir', 'reverse')
hold;
end
Now the matrix "R" changes with each loop and I'd like to update my quiver3 plot accordingly. So far I've tried pretty much every combination I got from google, like refreshdata, drawnow or linkdata... but nothing worked.
I'd really appreciate it, if someone has a suggestion for me.
tia Vinci
  댓글 수: 1
Sean de Wolski
Sean de Wolski 2013년 10월 28일
How are you calling linkdata?

댓글을 달려면 로그인하십시오.

답변 (1개)

Vinci
Vinci 2013년 10월 29일
Hey there
Actually, I just figured it out! I didn't know that you can link U,V and W data from the quiver3 plot as well...
So at first I always had my vectors drawn from the endpoint from the previous vector to a new position instead of from the origin to the new position. Looking up the quivergroup properties helped (<http://www.mathworks.de/de/help/matlab/ref/quivergroupproperties.html)>!
if true
set(h1, 'XDataSource', '0', 'YDataSource', '0', 'ZDataSource', '0');
set(h2, 'XDataSource', '0', 'YDataSource', '0', 'ZDataSource', '0');
set(h3, 'XDataSource', '0', 'YDataSource', '0', 'ZDataSource', '0');
set(h1, 'UDataSource', 'r(1,1)', 'VDataSource', 'r(1,2)', 'WDataSource', 'r(1,3)');
set(h2, 'UDataSource', 'r(2,1)', 'VDataSource', 'r(2,2)', 'WDataSource', 'r(2,3)');
set(h3, 'UDataSource', 'r(3,1)', 'VDataSource', 'r(3,2)', 'WDataSource', 'r(3,3)');
linkdata on
end
Now the plot gets updated correctly.

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by