How to solve this undefined problem?

조회 수: 10 (최근 30일)
Daniel Chew
Daniel Chew 2022년 3월 21일
댓글: Matt J 2022년 3월 21일
Now im facing
Error: Undefined function or variable n
the value n is actually i get it from the other file that prompt user to enter num of patients
n = input('Enter number of patients : ');
both files are located in the same file and the matlab is also opening the current file that located both files named start.
I also have try adding
n = p;
in the choiceThree file for trying to use a variable that has not been defined before this line of code executes. But the ouput still show out
Error: Undefined function or variable p
By the way, both files i got write
function output = start
in start file and
function output = choiceThree(n);
in choiceThree file
  댓글 수: 1
Matt J
Matt J 2022년 3월 21일
We need to see the innards of both functions to really know what's wrong.

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

답변 (1개)

Matt J
Matt J 2022년 3월 21일
I also have try adding n = p
The error message says that p is undefined. Therefore, you should be doing p=n.

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by