Most likely, you have a variable called SEM in your workspace which shadow your SEM function. Hence you're indexing that variable instead of calling the function. Get rid of that variable or rename it.
Note that your sem function will give incorrect results for matrices that have more columns than rows because of the use of length. I would strongly recommend replacing length(x) by size(x, 1) but that is irrelevant for your error.