Forget the sliding sts per inch thing, and just use a ruler. You would want to knit about 6 to 10 more stitches than the pattern says for 4", and measure 4" worth of stitches in the middle of a row. Do that in several places to make sure it's consistent. Don't include edge stitches because they curl under and aren't the same size as the ones in the center.
So if the gauge for the pattern is 19 sts per 4", CO about 24 sts, knit for about 3" then measure your piece. Count how many sts are in a 4" measurement across the row. The reason gauges are given as per 4" is because it's really hard to measure a partial stitch which you would get at 4.75 sts per in the example of 19 sts I gave. Even 9½ sts per 2" would be hard to get accurate.