Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
c.m.f.s.
c.m.f.s. le 8 Oct 2015
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.

Réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by