S-Function Block and Masking Parameters
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Atit
am 19 Jun. 2014
Kommentiert: Kaustubha Govind
am 26 Jun. 2014
I have created an S-function (Level2) and included a callback function in its 'OpenFcn' under Block Properties. This callback reads an xls file and assigns data read to the S-Function parameters (variables). I would like perform the following items: 1) Display the data read at respective Mask Parameters of the S-Function block 2) Based on the data read, change the number of input and output port of the S-function block. (Example, if suppose there are 3 rows of data in the xls, the number of input ports will be 3). Any help or ideas on this would be greatly appreciated.
Atit
0 Kommentare
Akzeptierte Antwort
Kaustubha Govind
am 20 Jun. 2014
To set the number of inputs/outputs based on parameter values, you can add code such as the following to your setup function:
block.NumInputPorts = block.DialogPrm(1).Data;
block.NumOutputPorts = block.DialogPrm(2).Data;
You can display the value of the parameters using block.DialogPrm(idx).Data
2 Kommentare
Kaustubha Govind
am 26 Jun. 2014
- AFAIK, int_T is defined as int32_T on 32-bit machines and int64_T on 64-bit machines. It is used to maintain platform independence (see What are the real_T and int_T datatypes referenced in the Simulink template CMEX S-function?)
- You must use mxGetPr only for double arrays (default type in MATLAB) only. This returns a double-pointer as documented.
There is no built-in debugger for S-functions because they are essentially shared libraries (DLLs) with a predefined format - the binary format itself depends on the MEX compiler that is used and is not MATLAB-specific. This is why we recommend debugging with your C compiler tools.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Block and Blockset Authoring finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!