Microscopy investigations of the microstructural change and thermal response of cobalt-based nanoparticles confined inside a carbon nanotube medium