stub of the function scripts
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
% create a vector with a random numbers
|
||||
% create a vector with random numbers
|
||||
x = rand(1000000, 1);
|
||||
|
||||
fprintf('time needed to manually filter elements smaller than 0.5 in a vector of length %i\n', length(x))
|
||||
fprintf('Time needed to manually filter out elements smaller than 0.5 in a vector of length %i\n', length(x))
|
||||
|
||||
tic
|
||||
results = [];
|
||||
@@ -14,7 +14,7 @@ for i = 1:length(x)
|
||||
end
|
||||
toc
|
||||
|
||||
fprintf('\ntime needed to do the same with logical indexing\n')
|
||||
fprintf('\nTime needed to do the same with logical indexing\n')
|
||||
|
||||
tic
|
||||
results = x(x < 0.5);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
>> logicalIndexingBenchmark
|
||||
time needed to manually filter elements smaller than 0.5 in a vector of length 100000
|
||||
Time needed to manually filter elements smaller than 0.5 in a vector of length 100000
|
||||
Elapsed time is 0.008562 seconds.
|
||||
|
||||
time needed to do the same with logical indexing
|
||||
Time needed to do the same with logical indexing
|
||||
Elapsed time is 0.001543 seconds.
|
||||
Reference in New Issue
Block a user