Filter löschen
Filter löschen

Can't figure out this debugging error

1 Ansicht (letzte 30 Tage)
liu James
liu James am 16 Dez. 2016
Beantwortet: Stephen23 am 16 Dez. 2016
I'm getting this error:
Error: File: strategy.m Line: 146 Column: 4
The function "nonEmptyNum2Cell" was closed with an 'end', but at least one other function
definition was not. To avoid confusion when using nested functions, it is illegal to use both
conventions in the same file.
for this section of coding:
function Y = nonEmptyNum2Cell(X)
% Data conversion (matrix to cell array)
%%Data conversion (number to cell array)
% If X is not empty, then convert from number to cell array
if isempty(X) == false
Y = num2cell(X);
else
Y = X;
end
end
I'm not sure why I'm getting this error since it looks like they are all closed on my end.
Help

Akzeptierte Antwort

Stephen23
Stephen23 am 16 Dez. 2016
Read the error message again. It tells you clearly that either all functions in the file need to use end, or none of them. You cannot combine these and have some of your functions with end and others without end.
Check your entire file and you will find that some functions do not use end.
My advice would be to use end for all functions.

Weitere Antworten (0)

Kategorien

Mehr zu File Operations finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by