フィルターのクリア

Simple for and if loop got wrong...

1 回表示 (過去 30 日間)
buer
buer 2014 年 12 月 11 日
コメント済み: buer 2014 年 12 月 11 日
Hi,
My mind looks like got some water...I just can not figure out what is wrong with this.
for i=1:100,
if(((data_cell{i,1})<= time)&&((data_cell{i+1,1})> time))
[row,col]=find(data_cell{i,1});
end
end
I just want to find the value point, where data{i,1}is samller than time, and data {i+1,1}is bigger than time... but the result always gives the last value until i is 100... It should find the value and stop the loop...anyone please give some idea...
Thanks.

採用された回答

Guillaume
Guillaume 2014 年 12 月 11 日
You appear to be very confused indeed about the usage of find. Assuming that data_cell{:, 1} and time are scalar, and assuming that data_cell{:, 1} is monotonically increasing
data_col1 = cell2mat(data_cell(:, 1));
thresholdpoint = find(data_col1 > time, 1);
  1 件のコメント
buer
buer 2014 年 12 月 11 日
Thanks so much Guillaume, it works..I will check again find function....:D

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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