MATLAB: Which is faster, a row vector or a column vector? Can anyone answer me please

matrix

I am trying to do some integration so I am defining the output as a matrix, my question is which definition will give me faster results to define my matrix :
A = zeros(1,n) or A = zeros(n,1)?
Regards

Best Answer

Perhaps the column, as MATLAB uses column-major memory storage of arrays. But really it is unlikely to make a big difference.
Just try it and use timeit or tic and toc to compare the times.
Another very fast way to define a matrix of zeros is this:
A(n) = 0;
Or if speed really is that critical, you might like to check out some of the submissions on MATLAB File Exchange: