Why my code is not working in simulink while its ok in matlab?

1 次查看(过去 30 天)
I have following code
input = [1,0,1,0,0,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,1,0,1,0,1,0,1,1,1,1,1,1,0];
[m,n] = size(input);
i = 1;
startSig = [1,0,1];
allSwitch = zeros(3,n);
while i <= n-2
if isequal(input(1,i:i+2),startSig)
outputSwitch = bi2de(input(1,i+4:i+5));
j=i+6;
% cond = 0;
k = 1;
output = zeros(1,n);
while j <= n && input(j) ~= 0
output(j) = input(1,j);
k = k+1;
j = j+1;
end
allSwitch(outputSwitch,:)=output;
i = j+1;
else
i = i+1;
end
end
Switch1 = allSwitch(1,:)
Switch2 = allSwitch(2,:)
Switch3 = allSwitch(3,:)
But when I use this code deleting the input values in simulink matlab use defined function block I did not get any out. I use here same input sequence used in matlab as square pulse.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by