> I get results similar to http://stackoverflow.com/questions/1693429/is-matlab-oop-slow-or-am-i-doing-something-wrong. At my old work (2012-2013) it skipped running the JIT compiler on the entire script-only (no parameter passing, all global variables, but several for-loop sections) codebase just because I added one top-level function call that passed in a string. 10X slower, if not more. Nowhere was this documented or indicated in the profiler, which was really frustrating. My boss and I were astonished and then switched to Python/Numpy for further algorithm development since we had a lot of work to do and needed OOP and speed.
%Set value at many index pairs in matrix a = zeros(3,3); rows = [1 2 3]; cols = [3 1 2]; a(sub2ind(size(a),rows,cols)) = [1 2 3]
%Moving average for large N y = cumsum(x)/N; y(N+1:end) = y(N+1:end) - y(1:end-N);
a = [1,2,3; 4,5,6; 7,8,9]; b = rand(3,3); c = rand(3,3); plot(a,b,'b-',a,c,'g-') %Burps on legend legend('1','2'); %Reshaping to vectors fixes it plot(reshape(a,1,[]),reshape(b,1,[]),'b-',reshape(a,1,[]),reshape(c,1,[]),'g-'); legend('1','2');
get(0,'PointerLocation')
a = axes; get(a,'CurrentPoint');