Can't figure out this debugging error

1 次查看(过去 30 天)
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

采纳的回答

Stephen23
Stephen23 2016-12-16
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 File Operations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by