Method for controlling a battery comprising at least one battery module string consisting of a plurality of battery modules coupled to one another, a battery module having a coupling unit which is designed in such a manner that a positive battery module voltage (U mod) and a voltage of 0 V can be selectively output by the battery module, the method comprising the following steps of: - requesting a battery or battery string output voltage to be provided; - determining a number of battery modules needed to provide the requested output voltage; - selecting battery modules until the required number of battery modules has been reached on the basis of at least one of the following battery characteristic variables: - the state of charge (S3.1), in which case battery modules with a high state of charge are more likely to be selected than battery modules with a low state of charge if the current from the battery or the battery string has a value of greater than zero, or battery modules with a low state of charge are more likely to be selected than battery modules with a high state of charge if the current from the battery or the battery string has a value of less than zero, - the temperature (S3.2), in which case battery modules with a low temperature are more likely to be selected than battery modules with a high temperature, - the ageing (S3.3), in which case battery modules with a high state of health are more likely to be selected than battery modules with a lower state of health, - the service life (S3.4); - providing the requested battery or battery string output voltage; a coupling unit comprising a first input, a second input, a first output and a second output and a first, a second, a third and a fourth switch (35, 36, 37, 38), the first switch being connected between the first input and the first output, the second switch being connected between the second input and the second output, the third switch being connected between the first input and the second output, and the fourth switch being connected between the second input and the first output, the coupling unit being designed to connect the first input to the first output via the first switch and to connect the second input to the second output via the third switch or to connect the first input to the second output via the third switch and to connect the second input to the first output via the fourth switch in a first switching state in response to a first control signal and to connect the first output to the second output in a second switching state in response to a second control signal. - requesting a battery or battery string output voltage to be provided; - determining a number of battery modules needed to provide the requested output voltage; - selecting battery modules until the required number of battery modules has been reached on the basis of at least one of the following battery characteristic variables: - the state of charge (S3.1), in which case battery modules with a high state of charge are more likely to be selected than battery modules with a low state of charge if the current from the battery or the battery string has a value of greater than zero, or battery modules with a low state of charge are more likely to be selected than battery modules with a high state of charge if the current from the battery or the battery string has a value of less than zero, - the temperature (S3.2), in which case battery modules with a low temperature are more likely to be selected than battery modules with a high temperature, - the ageing (S3.3), in which case battery modules with a high state of health are more likely to be selected than battery modules with a lower state of health, - the service life (S3.4); - providing the requested battery or battery string output voltage;