3d track plot in Matlab (ex-embedded) Function block

Hi,
I connected x,y,z coordinates in my custom matlab function block and I used this code:
function out = fcn(x,y,z)
%#codegen
coder.extrinsic('plot3')
coder.extrinsic('grid')
coder.extrinsic('axis')
plot3(x,y,-z, 'or')
axis([0 1 -0.0001 0.0001 -1 0])
grid on
out = [x,y,z];
(with a Terminator block in the output port)
to plot a trajectory, but it plots a dot since it updates itself as one at a time. How can I draw a trajectory as track in the space (I want make it store previous coordinates) ?

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2012년 11월 17일

0 개 추천

Save your data to workspace, then plot what you want!

댓글 수: 4

Marco
Marco 2012년 11월 17일
Ok, but in this way I don't see track during simulation; with saving/loading or To workspace block I should be wait for simulation end.
Then In your embedded function add
hold on
Azzi Abdelmalek
Azzi Abdelmalek 2012년 11월 17일
편집: Azzi Abdelmalek 2012년 11월 17일
I think Embedded function don't support hold on comand, use instead Matlab function block
Marco
Marco 2012년 11월 17일
It supports! Thanks!

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

카테고리

도움말 센터File Exchange에서 Simulink Functions에 대해 자세히 알아보기

질문:

2012년 11월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by