Created
November 17, 2024 19:37
-
-
Save summivox/696f6af9f60f125be06be8741f24fa00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rtp = rtp_assign(rtp, param) | |
% faster impl of `Simulink.BlockDiagram.modifyTunableParameters` for batch | |
% modification from struct | |
for i = 1:numel(rtp.parameters) | |
m = rtp.parameters(i).map; | |
n = numel(m); | |
for j = 1:n | |
k = m(j).ValueIndices; | |
name = m(j).Identifier; | |
if isfield(param, name) | |
rtp.parameters(i).values(k(1):k(2)) = param.(name); | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment