How can I change block parameters in simulink using block path in app designer?
3 次查看(过去 30 天)
显示 更早的评论
I want to change block parameters (by refrrencing the block's path) in simulink using app designer.
In order to make .exe file I used SimulationInput object as the below code:
simInp = Simulink.SimulationInput('test_model');
I can't use simInp.setBlockParameter because of this error:
and I couldn't use set_param because it dosen't accept SimulationInput object an an input.
Here is the full code:
function startupFcn(app)
start_simulink;
end
% Button pushed function: simulateButton
function simulateButtonPushed(app, event)
try
simInp = Simulink.SimulationInput('test_model');
simInp = simInp.setBlockParameter("test_model/Gain",'Gain',num2str(app.kkEditField.Value));
% set_param('test_model/Gain','Gain',num2str(app.kkEditField.Value));
simInp = simulink.compiler.configureForDeployment(simInp);
simOut = sim(simInp);
t = simOut.tout;
y = simOut.yout{1}.Values.Data;
plot(app.UIAxes,t,y);
catch ME
errordlg(ME.message);
end
end
Would you please help me about the solution?
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!