i can not figure out what is wrong with my code,when i call my function it does show eny outpout
Afficher commentaires plus anciens
function [out,temp]=zari(N)
x1=0; %to plithos Z1
x2=0; %to plithos Z2
x3=0; %to plithos Z3
x4=0; %to plithos Z4
sum1=0;
sum2=0;
sum3=0;
sum4=0;
temp= rand(1,N);
for i=1:N
if temp(i)== 10
out(i)=Z1;
x1=x1+1;
sum1=sum1+out(i);
%Z1 edra zariou = 10
else
if temp(i) == 20
out(i)=Z2;
x2=x2+1;
sum2=sum2+out(i);
%Z2 edra zariou = 20
else
if temp(i) == 30
out(i)=Z3;
x3=x3+1;
sum3=sum3+out(i);
%Z3 edra zariou = 30
else
if temp(i) == 40
out(i)=Z4;
x4=x4+1;%Z4 edra zariou = 40
sum4=sum4+out(i);
end
end
end
end
end
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Operators and Elementary Operations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!