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 CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by