function hanoi(n,from,to,work) if(n>0) hanoi(n-1,from,work,to); disp(['move the ',num2str(n),'th disk from ',from,' to ',to]); hanoi(n-1,work,to,from); end