MAKE Vector by loop and if statement

14 ビュー (過去 30 日間)
Ali Ahmed
Ali Ahmed 2022 年 4 月 23 日
回答済み: KSSV 2022 年 4 月 23 日
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

回答 (1 件)

KSSV
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

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by