How to read the n-d lookup table breakpoint names including Table Data name?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
0 Kommentare
Antworten (1)
Lokesh
am 26 Apr. 2024
Bearbeitet: Lokesh
am 26 Apr. 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 Kommentare
Lokesh
am 26 Apr. 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
Siehe auch
Kategorien
Mehr zu Programmatic Model Editing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!