You definitely need to post your LCS function for more detailed advice because that is the one that contains the error.
Somewhere in there you are attempting to index into an array using a 0-index which is not allowed as Matlab arrays index from 1.
To fix it you need to either change the behaviour of LCS or change your inputs to that function ( string3, string4 ) in such a way that they fit to the expectations of the function in a way that m and n are > 1. That is assuming that m and n are dependent on 'string3' and 'string4' that are passed in (or ar in fact the same variables as those)
i.e. either
- The function remains as is, but a prerequisite of its usage is that inputs must be > 1
or
- The inputs stay as they are and the function must change its implementation and thus its expectations so that 0, 0 are valid inputs which give expected outputs.
Best Answer