When you see an error like this, you should go back and look at the assignments that were done. The error message should even tell you WHERE the problem occurs, in which line it happened. You could have helped here by actually providing the complete error, so we would not need to guess at what you did wrong.
Anyway, I won't bother to run your code, as it is a bit of a mess, and won't even run without me making edits to correct some obvious flaws, so there are surely other problems. Besides, I refuse to run any code that will overwrite pi.
A quick scan however shows that there are only a few subscripted assignments in the code, so why not look at those lines? As quick of a scan then shows you are subtracting a vector from a mess before, and putting it into fcns(1), clearly a scalar assignment. Since the result must be at least a vector, I'll bet the error came from that line. So considering the error message, and considering what shape the right hand side of that expression will be, you might reconsider what you are trying to do.
Best Answer