length error don't know why

조회 수: 8 (최근 30일)
Juan
Juan 2024년 3월 3일
댓글: Stephen23 2024년 3월 3일
  댓글 수: 2
Steven Lord
Steven Lord 2024년 3월 3일
Please show us the full and exact text of the warning and/or error messages (all the text displayed in orange and/or red in the Command Window.) That exact text may help us more easily determine the root cause of the error and be able to suggest a workaround or solution.
Matt J
Matt J 2024년 3월 3일
편집: Matt J 2024년 3월 3일
Please don't post your code as a screenshot. Please instead post it as formatted text, e.g.,
a=1;
b=2;
as well as a .mat file attachment with the inputs necessary to run the code.

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

채택된 답변

Walter Roberson
Walter Roberson 2024년 3월 3일
The error is not due to length(). The error is due to having run EDwithNetwork() without providing enough parameters
In particular, you would get that error if you pressed the green Run button to execute EDwithNetwork.
MATLAB never goes looking in the environment for variables that are named in the function() definition.
You should create some code that assigns values to variables that will be used by EDwithNetwork(), and then call the function passing in the appropriate values.

추가 답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2024년 3월 3일
Check this in the command window:
which length
If by mistake any variable or M-file was called by length, the variable can be removed with:
clearvars length
If a mistkaenly named M-file exists, then it should be deleted.
  댓글 수: 1
Stephen23
Stephen23 2024년 3월 3일
The CVX toolbox defines its own LENGTH function/method. I would not recommend deleting it.

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

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by