function r=oct_rmse(data,estimate)
% Function to calculate root mean square error from a data vector or matrix 
% and the corresponding estimates.
% Usage: r=oct_rmse(data,estimate)
% Note: data and estimates have to be of same size
% Example: r=oct_rmse(randn(100,100),randn(100,100));

% oct_delete records with NaNs in both datasets first
I = ~isnan(data) & ~isnan(estimate); 
data = data(I); estimate = estimate(I);

r=sqrt(sum((data(:)-estimate(:)).^2)/numel(data));
