1

I'm trying to use the function trapz to integrate a column vector of EMG data.

trapz(G);

However, it keeps coming up with the warning:

'Subscript indices must either be real positive integers or logicals'

I'm a complete novice so I am unsure why this is happening. All the values in my column vector are positive, and all of the online examples I have seen seem to be similar to mine yet mine does not work.

Any help would be greatly appreciated. Many thanks.

  • 4
    When you type in `which trapz`, does it show the path to the trapz.m or `trapz is a variable`? – Daniel Jun 09 '14 at 14:59
  • It says trapz is a variable – user3302244 Jun 09 '14 at 15:51
  • 1
    You have a variable `trapz` in your workspace which is shadowing the function `trapz` - MATLAB assumes you want the variable rather than the function. Do `clear trapz` to remove the variable. – nkjt Jun 09 '14 at 15:58
  • 1
    That has fixed the problem. It is always something simple. Thank you everyone who has responded to my question – user3302244 Jun 09 '14 at 16:10

0 Answers0