How to find the « DataType ID » of a class Simulink.IntEnumType

1 visualización (últimos 30 días)
daniel Monterrain
daniel Monterrain el 12 de En. de 2018
Editada: per isakson el 10 de Mzo. de 2019
Good morning I want to create a Sfunction Matlab level 2 that will use as input and output some variable of classes Simulink.IntEnumType. Each class Simulink.IntEnumType. is created by a .m file like the folowing :
classdef Valeur_State < Simulink.IntEnumType
enumeration
Valeur1 (0)
Valeur2 (1110)
Valeur3 (1120)
Valeur4 (1130)
Valeur5 (1140)
Valeur6 (1150)
Valeur7 (1160)
end
end
In the matlab level 2 S function I can define an input port that will accept the variable of my class Simulink.IntEnumType using the value -1 (inherited) for the «DatatypeID »
block.InputPort(3).DatatypeID = -1; % -1 for inherited block.InputPort(3).Complexity = 'Real';
I have checked that the Simulink.IntEnumType variable is available for the Sfunction code.
But for an output port, the documentation writes that the « DatatypeID » must be defined explicitely. My problem is that I don’t know how to find the « DatatypeID » of my class « Valeur_State » < Simulink.IntEnumType
I am looking for this information since a week without succes.
On the forum i have find the proposal of the following code : It is possible to register custom fixed-point data type in the Level-2 MATLAB file S-Function as follows:
% Register fixed point datatype to obtain datatype id i
sSigned = 1;
wordLength = 16;
fracSlope = 1;
fixedExp = -9;
bias = 0;
obeyDataTypeOverride = false;
dtID = block.RegisterDataTypeFxpFSlopeFixExpBias ...
(isSigned, wordLength, fracSlope, fixedExp, ias, obeyDataTypeOverride);
block.InputPort(1).DatatypeID = dtID;
but I don’t reach to use it and I do not understand how the function could find the DatatypeID of a class without sending the name of this classe to the function !
please help !
  1 comentario
daniel Monterrain
daniel Monterrain el 6 de Mzo. de 2019
My question (How to find DATA TYPE ID of a simulink ENUM class) is now a bloking point for my project. I have founded a solution not to use output of my matlab level 2 S function for output of class Simulink.IntEnumType, using blocks out of the S function and writing in this block from the S function using a set_param. it is oK (but not efficient?)
Now i want to compile my model to build a library and afer a standalone application. But the Set_param command cannot be used in this case!
How can i do ?
please help !

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Programmatic Model Editing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by