Error converting from Simulink.SimulationInput to double
조회 수: 8 (최근 30일)
이전 댓글 표시
Laxmi akshaya thela
2024년 8월 18일
댓글: Laxmi akshaya thela
2024년 8월 19일
%% Speed Array
Speed = zeros(1,5001);
len = numel(Speed);
q=0;
for s = 1:len
Speed(1,s) = q;
q = q + (1/(len-1));
end
Trq_inst = zeros(1,401);
len_trq = numel(Trq_inst);
Trq_ref =1;
for t = 1:(len_trq)
% simIn = zeros(1,401);
% simOutputs = zeros(1,401);
Trq_inst(1,t)= Trq_ref;
for i = 1:len
simIn(i) = Simulink.SimulationInput('fl_name');
simIn(i) = setBlockParameter(simIn(i),'fl_name/Speed_sweep','Spd',Speed(i));
end
simOutputs = sim(simIn);
for i = 1: len
Res1 = simOutputs(1,i).sldemo_absbrake_output{1}.Values.Res1.Data;
Res2= simOutputs(1,i).sldemo_absbrake_output{1}.Values.Res2.Data;
Struc = struct("Res1",Res1,"Res2",Res2);
fname = sprintf('Trq%d_Spd%d.mat', Trq_ins(1,t)*400,5000*Speed(1,i));
save(fname,"Struc")
%save("trq_400.mat","Struc")
end
I am getting an error for the Simulink.SimulationInput converting to double.
댓글 수: 0
채택된 답변
Laxmi akshaya thela
2024년 8월 18일
댓글 수: 2
Walter Roberson
2024년 8월 18일
(You should have Accepted my Answer instead of posting your own Answer and Accepting that.)
추가 답변 (1개)
Walter Roberson
2024년 8월 18일
Before
for t = 1:(len_trq)
insert
clear simIn
You have an existing simIn that is double precision.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!