Can anyone tell me why I am getting this error message while I am trying save a matlab function?

As far as I know, the matlab file has to have the same name as the matlab function. But, I am getting the following error message: Error: File: asynmotor.m Line: 7 Column: 17 Function with duplicate name "asynmotor" cannot be defined.

Answers (1)

When you have a function inside a script (something that requires R2016b or later), then the name of the function cannot be the same as the name of the script.

Categories

Asked:

on 14 Mar 2017

Answered:

on 14 Mar 2017

Community Treasure Hunt

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

Start Hunting!