필터 지우기
필터 지우기

How to not overwrite answers

조회 수: 5 (최근 30일)
Pas182
Pas182 2022년 6월 10일
댓글: Mathieu NOE 2022년 6월 13일
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
Pas182
Pas182 2022년 6월 10일
it's exactly what i was trying to do. Thank you so much!!
Mathieu NOE
Mathieu NOE 2022년 6월 13일
ok
success ?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by