Info

此问题已关闭。 请重新打开它进行编辑或回答。

Is it available for Matlab Function with variables?

2 次查看(过去 30 天)
Hello.
I'm making simulation result by iterating process with 'for' loop.
This is the code I have used.
for i=1:5
simOut = sim('TotalLoss');
J = C_C + i*0.05;
set_param('TotalLoss/Constant Current','constant','J');
end
As you see that code, I'm running the simulink 5 times while constant block value is varying with iteration time.
That is well worked.
in set_param matlab function, it consists of slx file which is simulink file with named 'TotalLoss' and
Constant block named 'Constant Current' and Parameter named 'constant' and Value named 'J'.
What I want to make is this.
What if I have many blocks named Constant Current1, Constant Current2, Constant Current3. etc.)
then If I want to change matlab function parameter with variables, what should I do?
I want to make in 1st iteration, run with Constant Current1, 2nd iteration, run with Constant Current2 like this.
Fianally, I want to change the block every Iteration.
I think, to do that, I should make the matlab function paramete to Variables.
Thank you.

回答(0 个)

此问题已关闭。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by