0
$\begingroup$

I have a MATLAB/Octave program for which I used the tic and toc functions to measure the time elapsed for some calculations. e.g.:

tic();
for k=1:200
...
...
end
time=toc();

so now I have the value time.

how can I include this (anywhere and anyhow) automatically on a plot? as a legend? as a label? as a title?

$\endgroup$

closed as off-topic by Bill Dubuque, Daniel W. Farlow, user1551, Shailesh, choco_addicted Jun 17 '16 at 3:51

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is not about mathematics, within the scope defined in the help center." – Bill Dubuque, Daniel W. Farlow, user1551, Shailesh, choco_addicted
If this question can be reworded to fit the rules in the help center, please edit the question.

1
$\begingroup$

You can do this with the num2str-function. To display time in the title use for example:

title(['running time ' num2str(time) 's'])

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.