0

I have a Matlab file with multiple functions defined. When calling the file, I get the following error: "Error: File: kmeans.m Line: 20 Column: 1\n Function definition is misplaced or improperly nested."

How can I get rid of the error?

Jadiel de Armas
  • 8,405
  • 7
  • 46
  • 62

1 Answers1

1

Make sure every function has a matching end.

Rafael Monteiro
  • 4,509
  • 1
  • 16
  • 28
  • That's actually not necessary. Just be consistent. If one function has an end, they all need it, and the other way around. – chappjc Apr 16 '14 at 18:21
  • @chappjc Sure, but I always suggest this as a "good practice" because they're needed for nested functions. So, if you always put an `end` you're most likely to not having this problem. :) – Rafael Monteiro Apr 16 '14 at 18:28