diary file_io.out % Working on file data. file_io.data is a file of % more or less random data. load 'file_io.data' file_io file_io = 4.5000 8.0000 3.0000 0 6.8000 7.0000 3.0000 0 10.5000 6.0000 6.0000 1.0000 15.5000 3.0000 6.0000 1.0000 16.0000 4.0000 6.0000 2.0000 18.9000 2.0000 6.0000 2.0000 23.5000 -1.0000 0 2.0000 33.6000 -5.0000 0 3.0000 34.8000 -5.0000 0 3.0000 x = file_io; % Get the basic statistics mean (x) ans = 18.2333 2.1111 3.3333 1.5556 var (x) ans = 116.2950 23.6111 7.7500 1.2778 std (x) ans = 10.7840 4.8591 2.7839 1.1304 % Make a new matrix for variables 1 and 4 y=[x(:,1) x(:,4)] y = 4.5000 0 6.8000 0 10.5000 1.0000 15.5000 1.0000 16.0000 2.0000 18.9000 2.0000 23.5000 2.0000 33.6000 3.0000 34.8000 3.0000 % plot y the simplest possible way. plot (y) % plot the two variables in y with a cyan dotted line and a plus at each point plot (y,'c:+') % plot the variables against each other. Green line with circles. plot (y (:,1), y (:,2),'go') % Get the covariance matrix cov (x) ans = 116.2950 -52.1292 -18.4625 11.5917 -52.1292 23.6111 8.9583 -5.0694 -18.4625 8.9583 7.7500 -1.3333 11.5917 -5.0694 -1.3333 1.2778 % Pearson's correlation coefficient corrcoef (x) ans = 1.0000 -0.9948 -0.6150 0.9509 -0.9948 1.0000 0.6622 -0.9229 -0.6150 0.6622 1.0000 -0.4237 0.9509 -0.9229 -0.4237 1.0000 spearman (x) ans = 1.0000 -0.2708 -0.1175 -0.2508 -0.2708 1.0000 0.7583 0.6417 -0.1175 0.7583 1.0000 0.7333 -0.2508 0.6417 0.7333 1.0000 diary off