MAKE Vector by loop and if statement
14 ビュー (過去 30 日間)
古いコメントを表示
I need to extrat the min value of the
y(i) but it is can not be stored as vector to find min value
u=length(Datatest.Timehhmm);
for i=1:u
z= Datatest.TotalGORscfstb(i);
if min(z)>200 && (Datatest.PDPpsia(i))<=(Datatest.PIPpsia(i))
y(i)
end
end
0 件のコメント
回答 (1 件)
KSSV
2022 年 4 月 23 日
If you want to store the index:
y = zeros([],1) ;
u=length(Datatest.Timehhmm);
count = 0 ;
for i=1:u
z= Datatest.TotalGORscfstb(i);
if min(z)>200 && (Datatest.PDPpsia(i))<=(Datatest.PIPpsia(i))
count = count+1 ;
y(count) = i ;
end
end
If you want to store values:
y = zeros([],1) ;
u=length(Datatest.Timehhmm);
count = 0 ;
for i=1:u
z= Datatest.TotalGORscfstb(i);
if min(z)>200 && (Datatest.PDPpsia(i))<=(Datatest.PIPpsia(i))
count = count+1 ;
y(count) = yourvalue; % find the value
end
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!