Skip to content

Instantly share code, notes, and snippets.

@summivox
Created November 17, 2024 19:37
Show Gist options
  • Save summivox/696f6af9f60f125be06be8741f24fa00 to your computer and use it in GitHub Desktop.
Save summivox/696f6af9f60f125be06be8741f24fa00 to your computer and use it in GitHub Desktop.
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