How to Initialise variables for simulink's matlab function block?

조회 수: 5 (최근 30일)
Pratap Bhanu Solanki
Pratap Bhanu Solanki 2011년 9월 24일
답변: Nicy Scaria 2019년 2월 13일
I using matlab R2010b matlab. In simulink I am not able to initialize the variables I want to use in 'matlab function block, I also used Preloadfcn callback as: set_param('mymodel/Test', 'Fish_rugg', loadvar);
my loadvar.m contains: time =0; I am using a matlab function block where I am updating value of variable 'time'.Now when I open my model 'Fish_rugg' and run it.Although my time is being initialised and also showing in workspace but it is showing error 'undefined variable 'time' first usage of variable define its class.I am not able to understand what is the problem in matlab function block that it is not using workspace variable.
Any help in this context will be greatly appreciable.

답변 (3개)

MAYANK JHA
MAYANK JHA 2015년 3월 29일
  댓글 수: 1
Alexis Artuso
Alexis Artuso 2016년 6월 10일
Hi MAYANK JHA,
I had the same problem and I am very happy to see your answer.
Thanks a lot,
Alexis

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


Fangjun Jiang
Fangjun Jiang 2011년 9월 24일
편집: John Kelly 2014년 6월 4일

Nicy Scaria
Nicy Scaria 2019년 2월 13일
hi, I couldn't find the link given above. Is it deleted?

카테고리

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