How to profile certain selected lines of .m script file ?

Say the script contains 1000 lines of code. I need to profile the last 400 lines. How can I achieve this ?
Can I put those 400 lines in a separate function and passing all the variables (many huge matrices) it needs, as arguments to that function ?

1 Comment

Why can't you profile the whole thing and then only look at the last part? 1000 lines seems a bit excessive for a script. It is usually better for performance and readability to split long functions and scripts into smaller parts. Having a smaller function also means that you can look at only the sub-analysis for that specific function.

Sign in to comment.

Answers (0)

Asked:

on 18 Dec 2017

Commented:

Rik
on 18 Dec 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!