Speed comparison of two functions using tic/toc
Show older comments
Hi, I am supposed to write a function and then to compare my code with built-in MATLAB-function (A\b), how can I do it? I know I can use tic toc function like this:
function [ z ] = My_Function(A,b)
tic
my code
toc
%Comparison with built-in
tic
MATLABfunction(A,b)
toc
end
But is there any function i could use to do deeper comparison and print the results? I would like the output of my function to look like this:
My_Function(A,b)
ans =
...
Time elapsed using your function is: XY seconds, time elapsed using built-in MATLAB function is YX seconds.
Thank you very much in advance
Accepted Answer
More Answers (0)
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!