The data in the "test.xlsx" file has some NaN values and hence might result in issues during the calculation of the exceedence probability so you can choose to remove it.
To calculate exceedence probability for each depth you should first fetch the current speeds for each depth and then use the "eprob" function on the current speeds. The output of the "eprob" structure will return a struct which contains the "eprob" field name which when accessed, returns the exceedence probability of that data. You can then plot the exceedence probabilities using the "meshgrid" and "contourf" function.
% Load data from Excel
data = readmatrix('test.xlsx');
% Optional: If you wish to remove the rows with NaNs
cleaned_data = rmmissing(data, 'MinNumMissing', 1);
% Replace data with cleaned_data in the optional scenario
depths = data(1, 2:end);
current_speeds = data(2:end, 2:end);
%Initialize matrix for exceedance probabilities
exceedance_probs = zeros(size(current_speeds));
% Calculate exceedance probability for each depth
for i = 1:length(depths)
speeds = current_speeds(:, i);
output = eprob(speeds);
exceedance_probs(:, i) = output.eprob; % Exceedance probability
end
% Prepare data for contour plot
[X, Y] = meshgrid(1:size(current_speeds, 1), depths);
% Plot
figure;
contourf(X, Y, exceedance_probs', 'LineStyle', 'none');
colorbar;
xlabel('Current Speed Index');
ylabel('Depth');
title('Exceedance Probability of Current Velocities');
For more information regarding the "meshgrid" and "contourf" functions, refer to the following documentations: