why the error in the following " set_param(BlockName,BlockParameter,StringValue); "
조회 수: 1 (최근 30일)
이전 댓글 표시
I am trying to change the parameters inside a Linear Transfomer Magnetization resistance and inductance [Rm(pu) Lm(pu)]:. These parameters are named as RmLm when I view the mask. I am using Embedded MATLAB function block to set the parameters using set_param. The full code for MATLAB function block as following:
function ChangeParam(u) %#codegen
coder.extrinsic('set_param');
coder.extrinsic('num2str');
BlockName = 'Transfomer_Dynamic/Linear Transformer';
BlockParameter = 'RmLm';
StringValue = [num2str(u) ' ' num2str(u)];
set_param(BlockName,BlockParameter,StringValue);
I am getting the following error and I tried to find the debug but I am not be able. could anyone help or recommend me any suggestions ?
Cannot change parameter 'Magnetization resistance and inductance [Rm(pu) Lm(pu)]: (RmLm)' of 'Transfomer_Dynamic/Linear Transformer'
while simulation is running Error in 'Transfomer_Dynamic/MATLAB Function' (line 10) set_param(BlockName,BlockParameter,StringValue);
댓글 수: 0
답변 (1개)
Walter Roberson
2023년 5월 10일
편집: Walter Roberson
2023년 5월 10일
Only tuneable parameters can be changed while the simulation is running.
In some situations it is workable to run a MATLAB function that sets parameters, then invokes sim() with a stop time, then examines results, and loops back to try different parameters.
댓글 수: 6
Walter Roberson
2023년 5월 14일
I do not know if there is a work-around. I think it would be worth experimenting with making the value a global variable as is discussed in the link, but I do not know if it will work.
참고 항목
카테고리
Help Center 및 File Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!