Electrical and magnetic properties of nanomaterials containing iron or cobalt nanoparticles