In this paper, we consider the problem of realizing associative memories via space-varying CNNs (cellular neural networks). Based on some known results and a newly derived theorem for the CNN model, we propose a synthesis procedure for obtaining a space-varying CNN that can store given bipolar vectors with certain desirable properties. The major part of our synthesis procedure consists of solving generalized eigenvalue problems and/or linear matrix inequality problems, which can be efficiently solved by recently developed interior point methods. The validity of the proposed approach is illustrated by a design example.