creating a for loop with multiple conditions.
Afficher commentaires plus anciens
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
Réponses (0)
Catégories
En savoir plus sur Test Model Components dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!