MATLAB: Function name confliction warning !

namewarning

whenever i code a function i get "Warning: Function sum has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. " error.I tried several names for my function, no change. How can i fix it?

Best Answer

If it is the first function in the file, make sure you rename the file as well. The name of the first function in the file will be overridden with the file name.
You can use "which" to test whether a proposed name is already used. For example,
>> which sum
built-in (/Applications/MATLAB_R2016a.app/toolbox/matlab/datafun/@double/sum) % double method
>> which add
add is a Java method % java.util.ArrayList method
>> which total
'total' not found.
so total could be used but sum and add would be recommended against.
Related Question