mode(0) clear n = 100000; lower_bound = 0.1*n; upper_bound = 0.6*n; a = rand(n,1); b = string(a); // case 1 : eval on each row tic(); i=1:(upper_bound-lower_bound+1)'; c(i,1) = zeros((upper_bound-lower_bound+1),1); c(i,1) = eval(b(lower_bound:upper_bound,1)); duration1 = toc() // case 2 : eval on the complete matrix tic(); d = zeros((upper_bound-lower_bound+1),1); d = string(d); d = b(lower_bound:upper_bound,1); d = eval(d); duration2 = toc() // case 3 :with an uggly loop tic(); e = zeros((upper_bound-lower_bound+1),1); for i = 1 : (upper_bound - lower_bound+1) e(i,1) = eval(b(i+lower_bound-1,1)); end duration3 = toc() // case 4 :with an uggly loop (eval on the complete matrix) tic(); f = zeros((upper_bound-lower_bound+1),1); f = string(f); for i = 1 : (upper_bound - lower_bound) f(i,1) = b(i+lower_bound-1,1); end f = eval(f); duration3 = toc()