hdlset_param question

6 commentaires
Hi @GLW,
Consider using relative paths instead of absolute paths. By navigating the hierarchy step by step, you can set the 'ReferenceModelPrefix' parameter effectively without encountering errors related to nested levels. To modify the code to handle nested Reference Models, try using my example code snippet below as a reference,
% Example code snippet to set 'ReferenceModelPrefix' for nested Reference Models
for i = 1:numel(refModelsFullPath)
% Extract the relative path from the current Reference Model to its parent
relativePath = strrep(refModelsFullPath{i}, 'SubSystem_Top/', '');% Set the 'ReferenceModelPrefix' using the relative path
hdlset_param(refModelsFullPath{i}, 'ReferenceModelPrefix', relativePath)end
Hope this will help resolve your problem.
@GLW,
So,to address this issue, you should ensure that refModelsFullPath{i} resolves to a valid Simulink object name or path. If refModelsFullPath is a cell array containing paths, then make sure that i indexes the correct path to the Reference Model you want to modify.Here is an example of how you can iterate over all paths in refModelsFullPath and clear the ReferenceModelPrefix parameter for each Reference Model:
for i = 1:numel(refModelsFullPath)
try
hdlset_param(refModelsFullPath{i}, 'ReferenceModelPrefix', ''); disp(['Cleared ReferenceModelPrefix for: ', refModelsFullPath{i}]);catch
disp(['Error clearing ReferenceModelPrefix for: ', refModelsFullPath{i}]);end
end
By iterating over each path in refModelsFullPath, this code snippet will attempt to clear the ReferenceModelPrefix parameter for each Reference Model and the try-catch block helps in handling any errors that may occur during the process.
Réponses (0)
Catégories
En savoir plus sur Get Started with HDL Coder dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!