How to not overwrite answers
조회 수: 5 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!