number from simulink to guide

조회 수: 1 (최근 30일)
Felipe Arriagada
Felipe Arriagada 2011년 7월 1일
Hello I have a problem in simulink. As I can monitor my program guide (static-text) result (integer) That gives me a display of simulink
  댓글 수: 3
Gerd
Gerd 2011년 7월 1일
Are you already able to see the result in the matlab command window?
Felipe Arriagada
Felipe Arriagada 2011년 7월 1일
I want to see the information that gives me a constant in simulink in my GUI program created

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

답변 (2개)

Gerd
Gerd 2011년 7월 1일
OK, now I think I know what you want. If you take a constant block in Simulink and write a variable name for the "Constant Value" you can change that value from the workspace. This procedure is also working when using a gui. You have to make sure to convert the number to a string num2str() in order to display the right value in text box. set(handles.textbox,'String',num2str(variable));
Gerd
  댓글 수: 1
Felipe Arriagada
Felipe Arriagada 2011년 7월 1일
find_system('name','simupic')
open_system('simupic')
set(handles.text1,'string',num2str(ton))%ton is a name of the variable in simulink
dont work ...

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


Paulo Silva
Paulo Silva 2011년 7월 2일
%Your system must be already open or loaded, if not do it!!!!
set_param(gcs, 'SimulationCommand', 'start') %start the simulation
while (strcmp(get_param(gcs, 'SimulationStatus'),'running'))
rto = get_param([gcs '/Display'],'RuntimeObject')
set(handles.text1,'string',num2str(rto.InputPort(1).Data))
pause(0.3) %wait 0.3 seconds, this is the refresh rate
end
  댓글 수: 1
Felipe Arriagada
Felipe Arriagada 2011년 7월 7일
paulo thanks for your answer.
this is my program guide. I can not run,
Ton = display in simulink
simupic = program in simulink
I hope you understand me.
1)
function programPic_OpeningFcn(hObject, eventdata, handles, varargin)
find_system('name','simupic')
open_system('simupic')
2)
function edit1_Callback(hObject, eventdata, handles)
sp=get(hObject,'string')
set_param('simupic/Sp','value',sp)
guidata(hObject,handles)
3)
function edit2_Callback(hObject, eventdata, handles)
kp=get(hObject,'string')
set_param('simupic/Kp','value',kp)
guidata(hObject,handles)
4)MOST IMPORTANT
function pushbutton1_Callback(hObject, eventdata, handles)
set_param(gcs,'simulationcommand','start')
rto=get_param([gcs 'simupic/Ton'],'RuntimeObject')
set(handles.text8,'string',num2str(rto.InputPort(1).Data)
in text 8 (static) want to see the information that the display of simulink...
tks

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

카테고리

Help CenterFile Exchange에서 Block Libraries에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by