Which is faster: using false or using logical(0) to preallocate a matrix to all logical zeros? Write a script to test this
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:5| Question number:34.5
All Answers
total answers (1)
Ch5Ex34.m
% Test to see whether logical(0) or false is faster
fprintf('Start with logical(0)\n\n')
tic
mat(1:100, 1:100) = logical(0);
toc
fprintf('Now for false \n\n')
tic
mat2(1:100, 1:100) = false;
toc
need an explanation for this answer? contact us directly to get an explanation for this answer