Plotting in a GUI in RTW

Hello everyone.
I've written an 'Embedded MATLAB Function' that allows me to plot realtime data from a Simulink model in a GUI (which I created in GUIDE).
function flag = fcn(x, y)
%#eml
eml.extrinsic('plot', 'findobj');
axesHandles = findobj('Type', 'axes', 'Tag', 'axTrack');
plot(axesHandles, x, y, 'b-');
flag = 0;
This code works without any problems when I just run simulations.
As soon as I try this within RTW, it doesn't work anymore. While RTW was running, I tried to plot a point on my GUI with the same syntax, but from the Command Window
axesHandles = findobj('Type', 'axes', 'Tag', 'axTrack');
plot(axesHandles, 0, 0, 'b+', 'MarkerSize', 10);
and it worked.
Does somebody know how to make it work in the EMF?
Thank you in advance.
Francesco

 채택된 답변

Francesco
Francesco 2011년 2월 15일

0 개 추천

I solved the problem using event listeners.

댓글 수: 1

Francesco
Francesco 2011년 2월 15일
http://www.mathworks.com/matlabcentral/fileexchange/24294-simulink-signal-viewing-using-event-listeners-and-a-matlab-ui

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

추가 답변 (2개)

Kaustubha Govind
Kaustubha Govind 2011년 2월 14일

0 개 추천

RTW generates code for embedded systems - MATLAB graphics are therefore not supported in generated code. In fact, documentation for eml.extrinsic clearly states that code is not generated for functions called this way.
Francesco
Francesco 2011년 2월 14일

0 개 추천

I see. Thanks. Do you know how I could plot the data I get from simulink?
(I get x and y coordinates and I would like to display them in my GUI)

카테고리

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

질문:

2011년 2월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by