Merocyanine-spiropyran photochemical transformation in polymers probing effects of random matrices