0

I have the following array in Matlab:

x = [15.618, 6.758, 4.273, 6.328, 94.995, 3.966, 6.334, 21.821,  5.402]

If I call mean(x) it works but when I call median(x) I'm getting the following error message:

Subscript indices must either be real positive integers or logicals.

Does somebody see the reason for it?

machinery
  • 5,972
  • 12
  • 67
  • 118
  • 5
    Did you define a variable named `median` in your workspace ? MATLAB is probably thinking you want elements from that variable when you call `median(x)` – Some Guy Feb 14 '16 at 17:04
  • Now I don't think so. How can I check if I have defined such a variable? – machinery Feb 14 '16 at 17:06
  • `whos median` will tell you about variable and `which -all median` can find what files with the name are available to MATLAB – Some Guy Feb 14 '16 at 17:08
  • That was the problem, thank you for the solution. Perhaps I'm overworked. – machinery Feb 14 '16 at 17:15

0 Answers0