- #1

- 9

- 2

I have a function in Matlab. I'd like to calculate the computation time of the function. How can I obtain the time? I think Matlab must include related functions as its internal functions.

Thanks in advance.

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- MATLAB
- Thread starter hurryon
- Start date

- #1

- 9

- 2

I have a function in Matlab. I'd like to calculate the computation time of the function. How can I obtain the time? I think Matlab must include related functions as its internal functions.

Thanks in advance.

- #2

- 9

- 2

Thanks in advance.

- #3

- 424

- 1

Code:

```
time1 = cputime;
bench;
cputime - time1
```

Obviously, you can substitute "bench" for your function to determine how long it takes to run. See "doc cputime" for more information.

- #4

- 2

- 0

Hello,

The tool in MATLAB built for this purpose is: "Profile".

In the MATLAB search at: "http://www.mathworks.com/" [Broken]

and typing "profile" will bring up the information.

Main commands are turning it on:

profile on

and viewing the results (after some execution):

profile viewer

kind regards.

The tool in MATLAB built for this purpose is: "Profile".

In the MATLAB search at: "http://www.mathworks.com/" [Broken]

and typing "profile" will bring up the information.

Main commands are turning it on:

profile on

and viewing the results (after some execution):

profile viewer

kind regards.

Last edited by a moderator:

Share:

- Last Post

- Replies
- 2

- Views
- 5K

- Replies
- 2

- Views
- 4K

- Replies
- 1

- Views
- 2K