Filter löschen
Filter löschen

refreshdata, drawnow, ... nothing works?

9 Ansichten (letzte 30 Tage)
Vinci
Vinci am 28 Okt. 2013
Beantwortet: Vinci am 29 Okt. 2013
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

Antworten (1)

Vinci
Vinci am 29 Okt. 2013
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.

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by