"mustafa senkaya" <email@example.com> wrote in message news:firstname.lastname@example.org... > Hi all, > i have script; > > if (ch_mis<tol_d)|(rms_vs_change < tol_m) |(best_mis <= ht) > m_fin=m_inv; > data_fin=data_inv(:, best_index(i+1)); > ['Solution converged with rms error: ', num2str(best_mis(i+1))] > break > end > > i wonder that, is there any way to know which statement works or provides > in if command; first, second or third?
As written? No, not without reevaluating the condition. All you know is that at least one of those conditions was satisfied. If it's important to know which one(s) I would precompute the results:
condition1 = (ch_mis<tol_d); condition2 = (rms_vs_change < tol_m); condition3 = (best_mis <= ht); if condition1 || condition2 || condition3 % Assuming all those are scalars % In here you can check the contents of condition1, condition2, or condition3. end
Note that this WILL evaluate all the conditions while the first may not due to the short-circuiting behavior of | when used in an IF statement.