Changing variable during loop simulation

Description of problem

Hi Brian users,
I am a newbie in the field of Brian2 simulators. I’m trying to simulate the SNN using Brian2 but am stuck on the way to importing input into the network. In more detail, I use the ‘for’ loop to run the simulation, each loop corresponds to one data point. For each data point, I create a periodical series of spikes to import it into network and I want to change one variable (G1.I_i) just before running a new loop. One important note is that ‘G1.I_i’ is a constant leaky current of neuron group.
I have tried store and restore but it didn’t work and I don’t know why. It would be perfect if you could help me to solve it or your ideas to create a periodical series of spikes in a different way are welcome.
Thank you very much!

Minimal code to reproduce problem

for i in range(nb_in):
    in_pair = input[i, :]
    G1.I_i = np.dot(in_pair, weight01)
    net.run(10*ms)

Hi @HuuDucDO.
Could you give some more details and perhaps executable code showing your issue? When you say “it didn’t work”, do you mean you get an error? If yes, what kind of error do you get?

There’s some documentation about input to networks here: Input stimuli — Brian 2 2.5.1 documentation
The store/restore mechanism is documented here: Running a simulation — Brian 2 2.5.1 documentation
Finally, his Brian tutorial also goes into a bit of detail about running things in a loop: Introduction to Brian part 3: Simulations — Brian 2 2.5.1 documentation

Hope that gives you some hints!
Marcel