MATLAB: Do I get “Array indices must be positive integers or logical values” error when using “angle” function

anglearrayarrays vs formulaserrorformulaformulasformulas vs arraysindicesMATLABpositive

Why do I get "Array indices must be positive integers or logical values" error when using "angle" function?
>> z = 22+i
>> a = angle(z)
>> z =
22.0000 + 1.0000i
Array indices must be positive integers or logical values.

Best Answer

Based on the error message, it seems like you have a variable with the name "angle" stored in your workspace that overshadows the "angle" function