Filtering the data using IF
1 次查看(过去 30 天)
显示 更早的评论
Hi, I have 2 variables (matrixes) Time (5810x1) and DF_x (5810x1). I'd like to display only DF_x rows that are equal to 0 and its Time (each row in matrix called Time corresponds to the same row in matrix called DF_x). I have created a code shown below but it doesn't work. In the DF_x matrix there are 12 rows with a value equal to 0, which means that the code should display 12 rows and 2 colums- DF_x and a given time for each value of DF_x. Unfortunately, the result shows more than 1300 DF_x rows all with zeros (which is not correct). It also shows 12 Time rows with a correct time but the rest is all zeros as well. Could you please help me to make this work? Thank you!
[m,n]=size(DF_x);
for i=1:m
for j=1:n
if DF_x(i,j)==0
DF_acas(i,j)=DF_x(i,j);
Time_acas(i,j)=Time(i,j);
end
end
end
acas=[Time_acas DF_acas];
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Filter Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!