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

5 Ansichten (letzte 30 Tage)
Pratap Bhanu Solanki
Pratap Bhanu Solanki am 24 Sep. 2011
Beantwortet: Nicy Scaria am 13 Feb. 2019
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.

Antworten (3)

MAYANK JHA
MAYANK JHA am 29 Mär. 2015
  1 Kommentar
Alexis Artuso
Alexis Artuso am 10 Jun. 2016
Hi MAYANK JHA,
I had the same problem and I am very happy to see your answer.
Thanks a lot,
Alexis

Melden Sie sich an, um zu kommentieren.


Fangjun Jiang
Fangjun Jiang am 24 Sep. 2011
Bearbeitet: John Kelly am 4 Jun. 2014

Nicy Scaria
Nicy Scaria am 13 Feb. 2019
hi, I couldn't find the link given above. Is it deleted?

Kategorien

Mehr zu Simulink Functions finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by