Jump command in MATLAB

前端 未结 4 1471
[愿得一人]
[愿得一人] 2020-12-04 01:38

I\'m working with the m-file editor of MATLAB and I need to jump from one line to another. If I need to jump from inside a For...end, I can\'t use

4条回答
  •  一生所求
    2020-12-04 02:21

    that solves the problem easily:

    caseno = input('input your case no');
    
    switch (caseno)
         case 1
              disp('this first section will run');
         case 2
              disp('this second section will run');
         otherwise
              disp('wrong case no');
    end
    

提交回复
热议问题