length error don't know why

10 Ansichten (letzte 30 Tage)
Juan
Juan am 3 Mär. 2024
Kommentiert: Stephen23 am 3 Mär. 2024
  2 Kommentare
Steven Lord
Steven Lord am 3 Mär. 2024
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 am 3 Mär. 2024
Bearbeitet: Matt J am 3 Mär. 2024
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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 3 Mär. 2024
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.

Weitere Antworten (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov am 3 Mär. 2024
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 Kommentar
Stephen23
Stephen23 am 3 Mär. 2024
The CVX toolbox defines its own LENGTH function/method. I would not recommend deleting it.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by