필터 지우기
필터 지우기

Problem with calling upon a Simulink model from a GUI

조회 수: 2 (최근 30일)
Roy Veldhuizen
Roy Veldhuizen 2012년 6월 29일
I've got two simulink models, which are called by a GUI. I first developed the program, and i'm now implementing this in a GUI. When I'm calling, from a certain GUI function to my simulink model, called invcleanx.mdl, it gives the following error: Invalid Simulink object name: invcleanx. The error originates from the calling upon the workspace of the model, from:
hws = get_param(invclean,'modelworkspace') ;
I thought this might be an workspace issue, so I changed the callsign to the entire root, thus C:/Mydocuments/.../invcleanx
However, I still get the error:Invalid Simulink object name: C:\Documents and Settings\Administrator\Mijn documenten\My Dropbox\TU\Stage\Program\invcleanx.
So I guess, this is not the issue (or it is the wrong solution). I do not have the problem when I have the window of invcleanx.mdl open in Simulink, so apparently it is able to find if then. I now resolved the error by putting open_system('invcleanx') just before the reload command, but this is not favorable, since it takes time to load and open the model every time i run my calculation.
Am I not referring to my model in the correct way?
Thanks in advance,
Roy

채택된 답변

TAB
TAB 2012년 6월 29일
In your question you have mentioned:
I do not have the problem when I have the window of invcleanx.mdl open in Simulink, so apparently it is able to find if then. I now resolved the error by putting open_system('invcleanx') just before the reload command, but this is not favorable, since it takes time to load and open the model every time i run my calculation
It is not at all possible to read/write/change the model from command line until it is opened or loaded in the memory. Model must be opened using open_system() or it must be loaded into memory using load_system() before doing any operation on it.
  댓글 수: 1
Kaustubha Govind
Kaustubha Govind 2012년 6월 29일
I agree with TAB. Note that load_system won't open the model visibly, but will keep it open in the background (unlike open_system). This might be faster than open_system.

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

추가 답변 (1개)

Ilham Hardy
Ilham Hardy 2012년 6월 29일
편집: Ilham Hardy 2012년 6월 29일
How about,
hws = get_param('invclean','ModelWorkspace') ;
instead of
hws = get_param(invclean,'modelworkspace') ;
HTH,
IH
  댓글 수: 1
Roy Veldhuizen
Roy Veldhuizen 2012년 6월 29일
Hello Ilham,
Thank you for reply, but I'm not sure how to implement this, since i'm not typing invcleanx directly, but it is string which is saved. I replaced for clarity reasons, which is backfiring now =p This is the whole relevant story:
function Toolex_OpeningFcn
filestruct.filename='estimationmodelgood';
filestruct.filenamemodel='C:\Documents and Settings\Administrator\Mijn documenten\My Dropbox\TU\Stage\Program\invcleanx';
set(handles.output,'UserData',filestruct)
function Calculation_Callback
filestruct=get(handles.output,'UserData')
hws = get_param(filestruct.filenamemodel,'modelworkspace') ;
hws.reload;
Is it possible to remove the quotations from a string?
Hope this makes my problem a bit clearer.

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

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by