Can't figure out this debugging error
1 view (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
Stephen23
on 16 Dec 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.
0 Comments
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!