excel if statement to matlab

8 ビュー (過去 30 日間)
Engineer Undergoing
Engineer Undergoing 2021 年 7 月 30 日
コメント済み: Rik 2021 年 8 月 2 日
so i know there are many efieciant ways to do things on matlab without the need to use the if statement, and I was wondering if someone could help out on converting this excel formula/code to matlab without the need for a double if statements


Monika Jaskolka
Monika Jaskolka 2021 年 7 月 30 日
編集済み: Monika Jaskolka 2021 年 7 月 30 日
I don't see that a "double if" is necessary:
x = 0;
if (~E5 && E4)
x = F4 + 1;
x = F4;
If you are asking for a one line conditional assignment like below, Matlab doesn't support this syntax
condition ? true-expression : false-expression
  6 件のコメント
Rik 2021 年 8 月 2 日
@Monika Jaskolka Consider teaching yourself to use numel instead of length. It is never a worse option, and it might save you from a difficult bug hiding in your program due to array input (instead of vector inputs).


その他の回答 (0 件)


Find more on Data Import from MATLAB 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!

Translated by