Having a group of arrays, eg
C3_mu, Cp3_mu, C4_mu, Cp4_mu, Cz_mu,
C3_beta, Cp3_beta, C4_beta, Cp4_beta, Cz_beta
I want to perform operations on them in a for loop.
I've tried the following:
channels = [C3_mu, Cp3_mu, C4_mu, Cp4_mu, Cz_mu,
C3_beta, Cp3_beta, C4_beta, Cp4_beta, Cz_beta]
for chan in channels:
chan = np.transpose(chan)
but soon realized that, in this way, "chan" would be replaced by the array itself, and I can't see the right way of doing this.
您可以使用列表理解:
channels = [np.transpose(chan) for chan in channels]
Use enumerate()
for i, chan in enumerate(channels):
channels[i] = np.transpose(chan)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.