cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Observer
Observer
8,426 Views
Registered: ‎01-15-2008

system generator token parameter can assign any valiable with M-file?

Hi everyone,

Can i assign a valiable to system generator token parameter and gateway in parameter with M-file?

I have tried the Simulink block digram. It can pass the parameter to M-file.

I have attached the file for references.



Thanks.


problem1.JPG
0 Kudos
3 Replies
Highlighted
Explorer
Explorer
8,410 Views
Registered: ‎08-14-2007

Yes, just write the variable name, or any more complex matlab expression in the dialog boxes, and use an M-script to initialise the variables that you use in those expressions.

Anywhere you can put a number in a simulink dialog, you can also put a Matlab expression.

Cheers,
Martin
Martin Thompson
martin.j.thompson@trw.com
http://www.conekt.co.uk/capabilities/electronic-hardware
0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
8,396 Views
Registered: ‎08-07-2007

Also note that the variable must be defined in the workspace.  If it is defined in an m-script this script must be run so that it can be found in the MATLAB workpace.
0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
8,391 Views
Registered: ‎08-02-2007

On a different note, if you go to file -> model properties in the .mdl, you can set callback functions to define a variable.

For instance, you can have a PreLoadFcn that sets a variable upon opening your .mdl that you can reference in your design.
0 Kudos