Effacer les filtres
Effacer les filtres

Write output list from a loop

2 vues (au cours des 30 derniers jours)
Ivy Chen
Ivy Chen le 7 Juil 2018
Commenté : Ivy Chen le 7 Juil 2018
I have two .mat files (A & B). Once find a first occurrence of the defined index. I want to write them out to a array or table.
The following code only write the last entry, and I played with it for a while and still can not get it right. Appreciate help on this.
tstart=datetime(A.StartUTC,'Convertfrom','excel');
tend=datetime(A.EndUTC,'Convertfrom','excel');
UTCtime=datetime(B.date, 'InputFormat', 'yyyy-MM-dd HH:mm:ss');
for Pf_No = 1:size(A, 1)
Day=char(A.Day(Pf_No));
Scenario=char(A.Scenario(Pf_No));
Idx=(UTCtime>=tstart(Pf_No) & UTCtime<=tend(Pf_No) & strcmp(B.Scenario,Scenario));
X = UTCtime(Idx);
BLK=find(isnan(B.b1(Idx)) | B.b1(Idx)==0 | B.b4(Idx)<4, 1 , 'first');
BLK_Time=X(BLK);
Breaklock_list={Day Scenario BLK_Time};
end

Réponse acceptée

Walter Roberson
Walter Roberson le 7 Juil 2018
Breaklock_list(Pf_no, :) = {Day Scenario BLK_Time};
  1 commentaire
Ivy Chen
Ivy Chen le 7 Juil 2018
Great, thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements 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