MATLAB: Read few lines from one *.m file and jump to another *.m file

Is it possible to read only few lines from one matlab code and then jump to another matlab code and read there another few set of lines and so on?

Best Answer

This is not the purpose of program code. If you need only some lines of a specific function, create a copy of this functions and remove the other lines. Fortunately there are no magic GOTO or COMEFROM commands in Matlab. Reading the files by fileread and evaluating some lines by eval is a very bad idea also, because you would create a Meta-Matlab-Interpreter, which is too indirect and prone to bugs to be used efficiently.