Effacer les filtres
Effacer les filtres

How to not overwrite answers

5 vues (au cours des 30 derniers jours)
Pas182
Pas182 le 10 Juin 2022
Commenté : Mathieu NOE le 13 Juin 2022
Hi,
in a for cycle i have the issue for that the answer to a command are overwritten. Below the code which i'm facing with:
for i=1:length(Lamp_config)
st1(i)=(strcmp(Lamp_config(i),h));
st2(i)=(strcmp(Lamp_config(i),o));
st3(i)=(strcmp(Lamp_config(i),l));
st4(i)=(strcmp(Lamp_config(i),m));
if st2(i)==1
o1=ismember(0,NaDFIR_from_tool(i,:));
o2=ismember(39,NaDFIR_from_tool(i,:));
o3=ismember(175,NaDFIR_from_tool(i,:));
o4=ismember(174,NaDFIR_from_tool(i,:));
o5=ismember(172,NaDFIR_from_tool(i,:));
o6=ismember(168,NaDFIR_from_tool(i,:));
o7=ismember(40,NaDFIR_from_tool(i,:));
if o1 == 1
'DTC enabled'
else
'DTC not enabled'
end
if o2 == 1
'1 trip failed'
else
'1 trip NOT failed'
end
if o3 == 1
'2 trip failed'
else
'2 trip NOT failed'
end
if o4 == 1
'3 trip failed'
else
'3 trip NOT failed'
end
if o5 == 1
'fault passing'
else
'fault NOT passing'
end
if o6 == 1
'1 trip healing'
else
'1 trip NOT healing'
end
if o7 == 1
'2 trip healing'
else
'2 trip NOT healing'
end
end
So in this way the "ans" is continuesly overwritten (DTC enabled --> 1 trip failed --> 2 trip failed and so...). My target is to save all the ans i get in a matrix.
How can I do it?
Thank you so much!
  3 commentaires
Pas182
Pas182 le 10 Juin 2022
it's exactly what i was trying to do. Thank you so much!!
Mathieu NOE
Mathieu NOE le 13 Juin 2022
ok
success ?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Logical 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