Matlab的递归调用,好久不用matlab了,练练手。

 

global handCount;

handCount = 1;

huuotsun(1, 2, 3, 3)

 

 

function huuotsun(cur, buf, tar, num)

    global handCount;

    if num == 1

        str = sprintf('c %d plate  %d to %d ', handCount, cur, tar);

        disp(str);

        handCount = handCount + 1;

    else

        huuotsun(cur, tar,buf, num -1);

        str = sprintf('c %d plate  %d to %d ', handCount, cur, tar);

        disp(str);

        handCount = handCount + 1;

        huuotsun(buf, cur,tar, num -1);

    end

end

 

 

相关文章:

  • 2022-12-23
  • 2022-01-11
  • 2021-11-02
  • 2021-09-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-12
  • 2021-06-10
  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案