SyntaxFix
Write A Post
Hire A Developer
Questions
As mentioned in other answers you can use:
>> tic; x=5*ones(10,1); toc Elapsed time is 0.000415 seconds.
An even faster method is:
>> tic; x=5; x=x(ones(10,1)); toc Elapsed time is 0.000257 seconds.