fetch the datatype of input signal in simulink without using Mscript

1 visualización (últimos 30 días)
Vivek
Vivek el 5 de Feb. de 2014
Respondida: prabhat kumar sharma el 12 de Dic. de 2024
Is there any way to fetch the datatype of input signal in simulink without using Mscript. I want to connect a Fcn block to a Inport. According to Inport datatype there shall be different logic. So I want to find datatype of Inport using the Fcn block. I tried "get_param(u,'SignalType')" and its a syntax error.
Please provide me some suggestion on this

Respuestas (1)

prabhat kumar sharma
prabhat kumar sharma el 12 de Dic. de 2024
Hi Vivek,
I understand that you want to implement different logic based on the different data type of the signal. But In Simulink, directly fetching the data type of a signal within the model (such as from an Inport block) using a Fcn block is not possible. The Fcn block is designed to perform mathematical operations and does not have the capability to determine signal properties like data type.
However, there are a few approaches you can consider for handling different logic based on the data type of an input signal:
  1. Data Type Conversion Block:
  • Use a Data Type Conversion block to explicitly convert the signal to a known data type before it enters the Fcn block. This ensures that you know the data type and can implement the appropriate logic.
2. Variant Subsystems:
  • Use Variant Subsystems to switch between different implementations based on the data type. You can control the variant conditionally based on the data type using a MATLAB script or a mask parameter.
3.Custom S-Function:
  • Create a custom S-Function that can access the data type of the input signal and implement the required logic based on that. S-Functions have more access to the simulation environment and can be programmed to check signal properties.
I hope it helps to resolve the issue!

Categorías

Más información sobre Schedule Model Components en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by