Borrar filtros
Borrar filtros

Get port data type by script

7 visualizaciones (últimos 30 días)
Kaushik
Kaushik el 13 de Feb. de 2014
Comentada: rameshkumar rajarathanam el 10 de Mzo. de 2020
Hi, I need to get the data types of all the inputs and output of arithmetic blocks in my model. I got the required results using 'CompiledPortDataType' command. But before using this command, the model has to be loaded and compiled. For this I used the commands load_system(Model_Name); and Model_Name([],[],[],'compile'). on using the compile command, I am getting following error. ??? Index exceeds matrix dimensions.
But on running the same command with Actual_Model_Name instead of variable storing the model name, I am able to compile the model. Also, if I compile the model with the last mentioned command, I am still not able to find the data types of the inport of the Arithmetic blocks. Can anyone tell me what might be the problem. Here's the code I've written.
load_system(Model_Name);
Model_Name([], [], [], 'compile')
Sum_blks = find_system(bdroot,'BlockType','Sum');
cnt = 1;
for sum_ctr = 1:length(Sum_blks)
blk_PH = get_param(Sum_blks{sum_ctr},'PortHandles');
Inport_handles = blk_PH.Inport;
for i = 1:length(Inport_handles)
InputDataType{cnt,1} = get_param(Inport_handles(i),'CompiledPortDataType');
cnt = cnt+1;
end
end
  1 comentario
rameshkumar rajarathanam
rameshkumar rajarathanam el 10 de Mzo. de 2020
try using eval('Model_Name([], [], [], 'compile')') instead.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by