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

조회 수: 1 (최근 30일)
daniel Monterrain
daniel Monterrain 2018년 1월 12일
편집: per isakson 2019년 3월 10일
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
daniel Monterrain
daniel Monterrain 2019년 3월 6일
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 !

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by