Info

This question is closed. Reopen it to edit or answer.

writing an if statement

1 view (last 30 days)
kyle pothier
kyle pothier on 19 Apr 2018
Closed: MATLAB Answer Bot on 20 Aug 2021

Hello I am currently trying to write an If statement that will go along a transact of data and end once one of the transacts becomes larger then the first one. Currently i'm trying to write the statement like this.

dunefront = zeros(1,562);
if predune >= postdune
    dunefront = predune;
end

any help would be appreciated. Thanks

Answers (1)

Walter Roberson
Walter Roberson on 19 Apr 2018
idx = find(transact > transacts(1), 1, 'first');
if isempty(idx)
   ... no transact exceeded the first
else
   ... idx is the index where it exceeded
end

Community Treasure Hunt

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

Start Hunting!