필터 지우기
필터 지우기

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

조회 수: 8 (최근 30일)
Manish singh
Manish singh 2024년 4월 26일
댓글: Lokesh 2024년 4월 26일
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.

답변 (1개)

Lokesh
Lokesh 2024년 4월 26일
편집: Lokesh 2024년 4월 26일
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
Manish singh
Manish singh 2024년 4월 26일
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 2024년 4월 26일
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

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

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by