smilingbuddha
smilingbuddha

Reputation: 14774

Terrible performance of the GNU Octave `scatter` function compared to MATLAB. Any replacement?

Why is the performance of scatter function so bad in Octave when compared with plot function? Also, the MATLAB version of the scatter function seems blazing fast compared to its Octave counterpart.

Here are some timings generated on my machine for comparing the efficiency of scatter vs plot

octave:1> 
octave:1> A = rand(1000,2);
octave:2> tic ; plot(A(:,1) , A(:,2));toc;
Elapsed time is 0.0407901 seconds.
octave:3> 
octave:3> 
octave:3> tic ; scatter(A(:,1) , A(:,2));toc;
Elapsed time is 6.16734 seconds.
octave:4> 

MATLAB requires 0.16229 seconds to perform the same scatter function on the same matrix 'A'.

Is there a faster version of scatter available for octave?

Upvotes: 0

Views: 1205

Answers (1)

abdulhaq-e
abdulhaq-e

Reputation: 626

This depends on your usage of scatter but it may be suitable for you:

plot(A(:,1) , A(:,2) , `o' )

*I don't use Octave but apparently, the string that specifies the format of the line begins with a "grave accent ` " unlike Matlab, according to this

Edit: In the examples in the above link, they were using double quotation marks! so the above would be:

plot(A(:,1) , A(:,2) , "o" )

Upvotes: 2

Related Questions