creating a for loop with multiple conditions.
이전 댓글 표시
Hello,
I have the following data
TEST DATE RESULT_A RESULT_B
in a table format
I'm trying to reformat so that if the test name is the same and date is the same then print a header and tabulate the rest of the results. else create a new header.
here is the code I have but it keeps creating a header for each row.
a= test
b= date
d=RESULT_A
e=RESULT_B
j=1:length(b)
for i = 1:length(a)-1
if strcmp(a{i},a{i+1}) && datenum(b{j,1})== datenum(b{j+1,1})
fprintf('\n\n\n\n%s\t%s \n','TEST' ,a{i})
fprintf('%s\t%s\n','DATEFORMAT','yyyy-mm-dd')
fprintf('%s\t%s\n','DATE',b{i})
fprintf('%s\n','"RESULT_A" "RESULT_B"')
fprintf('%s\t%s\t\n','RESULT_A','RESULT_B')
fprintf('%d\t%d\n',d(i),e(i)
end
end
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Test Model Components에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!