Saving (in a matrix) the elapsed time and number of iterations for a large number of cases
Show older comments
I have a program that outputs the *number of iterations* and a *test value*, given inputs *A1,A2,A3,A4*.
I want to run through 5 values each of A1, A2, A3, A4, thus making 625 runs. In the process, I want to save the *time elapsed* for each run, the *number of iterations*, and *test value* in 3 separate matrices.
I have tried using 4 nested *for* loops, and made progress, but need some help on indexing the elements of the matrices. The iterator variables in the for loops don't match the indexing variables...
The code for the 4 nested loops is below:
m = logspace(-4,4,5);
n = logspace(0,8,5);
eltime = zeros(5,length(m)*length(m)*length(m));
for A1 = m
for A2 = m
for A3 = m
for A4 = n
tic
SmallMAX(A1,A2,A3,A4)
toc;
for i=1:numel(eltime)
for j = 1:length(n)
eltime(j,i) = toc;
end
end
end
end
end
end
The code for the main program is excerpted below:
function [k,test] = OC(A1,A2,A3,A4)
...
end
Thanks for any help.
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating 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!