M-S-Function Data Type ID conversion from class name
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi all,
I have a M-S-Function (Level 2 Matlab S-Function) where the values driven to the output ports are read from MATLAB workspace variables, whose names are passed in as a parameter.
I want to make sure that the port's data type matches the data type of the variables.
It's easy enough to get the data type of the variable:
varnames = block.DialogPrm(1).Data
cls = class(evalin('base', varnames{1})); % for example
However, it's not possible to do block.OutputPort(1).Datatype = cls, as the Datatype field is read only. Instead, I can modify block.OutputPort(1).DatatypeID, which wants an integer, as per the table at http://www.mathworks.com.au/help/simulink/slref/simulink.blockdata.html#f29-108672
Is there an easy, existing, way to convert the class name (eg 'uint32') to the corresponding data type integer value (6)?
Also, the table does not mention how to convert classes int64, uint64 or logical to a port data type - is it possible to have a 64-bit integer on a simulink port?
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical 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!