Borrar filtros
Borrar filtros

How to read the n-d lookup table breakpoint names including Table Data name?

8 visualizaciones (últimos 30 días)
Hello,
For one of my automation scripts, I need to extract all the lookup table variable names (I.e., Table Data name, Breakpoint 1, Breakpoint 2,...etc) using MATLAB command.
I can extract the Table data Name only by using below code:
Lkup_Nme_ = find_system(path,'blockType','Lookup_n-D');
So, I am looking the solution in such a way, so that I can get the names of Table data, Breakpoints 1, Breakpoints 2. I.e. abc_Pbar_Zz, abc_Pbar_Xx and abc_A_Yy respectively.

Respuestas (1)

Lokesh
Lokesh el 26 de Abr. de 2024
Editada: Lokesh el 26 de Abr. de 2024
Hi Manish,
I understand that you are looking to extract the lookup table variable names using MATLAB commands. To achieve this, you can utilize the "get_param" command, which allows you to extract the values of block parameters. Here is a sample code snippet for your reference:
mdl = 'name_of_model';
load_system(mdl)
TableDataName = get_param([mdl,'/n-D Lookup Table'],'Table')
Breakpoint1_name = get_param([mdl,'/n-D Lookup Table'],"BreakpointsForDimension1")
Breakpoint2_name = get_param([mdl,'/n-D Lookup Table'],"BreakpointsForDimension2")
Refer to the following documentation for more information on 'get_param':
  2 comentarios
Manish singh
Manish singh el 26 de Abr. de 2024
Hi Lokesh,
There are many lookup table used in the model. For above command, it might be only possible if block handle is known. If I select the block and then try with your command, It will work. But my requirement is to get the name/value of all the available lookup table, by just giving the path.
Lokesh
Lokesh el 26 de Abr. de 2024
When there are multiple lookup tables used in the model, you can use 'find_system' to first find all instances of the blocks of interest and then iterate over them to extract the desired parameters.
Refer to this code snippet:
lookupTableBlocks = find_system('model_name', 'BlockType', 'Lookup_n-D');
for i = 1:length(lookupTableBlocks)
% Extract block-specific parameters
TableDataName = get_param(lookupTableBlocks{i},'Table');
Breakpoint1_name = get_param(lookupTableBlocks{i},"BreakpointsForDimension1");
Breakpoint2_name = get_param(lookupTableBlocks{i},"BreakpointsForDimension2");
% Display or store the extracted information
fprintf('Block: %s\n', lookupTableBlocks{i});
fprintf('Table Data Name: %s\n', TableDataName);
fprintf('Breakpoint 1 Name: %s\n', Breakpoint1_name);
fprintf('Breakpoint 2 Name: %s\n', Breakpoint2_name);
% You might want to store these in an array or cell array for later use
end

Iniciar sesión para comentar.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by