A method for adjusting resistance in a device, wherein the device comprises two magnetic elements (FM1, FM2) separated by an insulating element or semi-conductor (I), the resistance of the device being dependent on the position of a magnetic wall in one of the magnetic elements (FM1), the magnetic wall separating two areas of said magnetic element each having a separate homogeneous direction of magnetization, said device including means for moving the magnetic wall in said magnetic element (FM1) by applying a spin-polarized electric current (iE), the method comprising:
- injecting the spin-polarized current (iE) through the magnetic wall;
- moving the magnetic wall in a continuous range between a minimum resistance and a maximum resistance;
- and
- continuously adjusting the resistance in the device,
- wherein the minimum resistance is determined when magnetization directions of the two magnetic elements (FM1, FM2) are parallel with respect to each other and the maximum resistance is determined when the magnetization directions of the two magnetic elements (FM1, FM2) are opposite with respect to each other.