Step 1: Prepare your MATLAB codes in a script or function, say fileName.m. Step 2: Save all the variables in a MAT file. For example: save MATfileName.mat Step 3: Profile the MATLAB codes. profile on (run your MATLAB codes here, say filename(A,B,C,D)) profileStruct = profile('info'); Step 4: Count FLOPS by calling the function FLOPS(fileName,MATfileName,profileStruct); The parsing and counting results will be displayed on the screen and sent to output arguments.