How can I use an if statement to compare an input in a function script?

 採用された回答

OCDER
OCDER 2018 年 7 月 24 日
Your cell_num_mem_1 was never defined before the if statement. What is the value of this variable, or is it a function that returns a value?
p = 1;
cell_num_mem_1 = ???? %define a value here
if p == cell_num_mem_1
disp('if statement worked')
end

2 件のコメント

Jane Akintoye
Jane Akintoye 2018 年 7 月 24 日
"cell_nuc_mem_1" is defined in the command window. Is that not enough?
Jane Akintoye
Jane Akintoye 2018 年 7 月 24 日
oh nvm I see now, the all variables used in a function have to be defined in the function, thanks

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeEntering Commands についてさらに検索

質問済み:

2018 年 7 月 24 日

コメント済み:

2018 年 7 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by