필터 지우기
필터 지우기

To workspace block

조회 수: 2 (최근 30일)
Sébastien Malengé
Sébastien Malengé 2011년 5월 2일
Hi,
I use a GUI to run (or sim) a model from simulink. Everything is ok, but I have a "to workspace block" in my model which don't "write" in the workspace. Does Anybody know why ?
Thanks !
  댓글 수: 1
Kaustubha Govind
Kaustubha Govind 2011년 5월 2일
Are you looking in the workspace local to the GUI, or in the MATLAB base workspace? Do you see the same issue when you run the model independent of the GUI?

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

답변 (4개)

Titus Edelhofer
Titus Edelhofer 2011년 5월 3일
Hi Sebastien,
using a to file block is of course an alternative. For my answer above, using the set_param command is just for the contrary: it tells Simulink to put the data into your local workspace, e.g.:
function button1_Callback(hObject, eventdata, handles)
set_param('mymodel', 'DstWorkspace', 'current');
[t,x,y] = sim('mymodel');
% say, you have a ToWorkspace with name 'result':
% then you would have right now here the variable result, e.g.:
plot(handles.axes1, result(:,1), result(:, 2:end));
Titus

Titus Edelhofer
Titus Edelhofer 2011년 5월 2일
Hi,
it depends which workspace you expect the data to be: usually they are written to the base workspace. If you want them to be in the local workspace of your GUI function, you have to add
set_param(name_of_your_model, 'DstWorkspace', 'current')
Hope this helps,
Titus

Sébastien Malengé
Sébastien Malengé 2011년 5월 3일
@Kaustubha Govind : I'm looking in the MATLAB base workspace, and yes, if I run my model independent of the GUI, I have my output from the "to workspace block".
@ Titus Edelhofer : I'm going to try your solution, but I don't know if this can work because I don't have any data in the MATLAB base workspace.
Thanks by the way !

Sébastien Malengé
Sébastien Malengé 2011년 5월 3일
I change my block for a block "to file", that's works better, and I can use it with my GUI.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by