How to read the n-d lookup table breakpoint names including Table Data name?
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1679906/image.jpeg)
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 commentaires
Réponses (1)
Lokesh
le 26 Avr 2024
Modifié(e) : Lokesh
le 26 Avr 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 commentaires
Lokesh
le 26 Avr 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
Voir également
Catégories
En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!