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

"cell_nuc_mem_1" is defined in the command window. Is that not enough?
oh nvm I see now, the all variables used in a function have to be defined in the function, thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Entering 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