MATLAB: How to call m-file MATLABmfile Hello, I have an if condition in the intro of my code , and there are three cases i want to do like this in matlab (example )case 1 call mfile1, case 2 call mfile2, case3 call mfile3 thanks 🙂 Best Answer if value == 1 mfile1;elseif value == 2 mfile2;else mfile3;endOr alternately,switch value case 1: mfile1; case 2: mfile2; case 3: mfile3;endOr another way:fn = {@mfile1, @mfile2, @mfile3);fn{value}(); Related QuestionM-file functionMatlab M-FileLagrange Equations M-fileCannot call m-file in another m-fileNewton Raphson m-file
Best Answer