I would recommend changing the line
er = norm(s1-s2);
er = norm(s1./s2-1);
If I am comparing a struct, simply containing parameter values, it makes sense to use the relative error.
E.g. comparing 5e-12 with 4e-12 should not be a tolerance match.
23 Nov 2013
Compares two structured variables recursively and notes where the two structures are different.