MAKE Vector by loop and if statement
14 views (last 30 days)
Show older comments
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 Comments
Answers (1)
KSSV
on 23 Apr 2022
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 Comments
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!