err = readmatrix("Error Matrix.xlsx");
err_pos(err_pos<0) = NaN;
[min_val,id]= min(err_pos,[],'all','linear');
[r,c] = ind2sub(size(err),id);
max_val = max(abs(err),[],'all');
n = 2*ceil(max_val/min_val)+1;
h = heatmap(err,'GridVisible',false);
caxis([-max_val max_val])
matvisual(err, 'annotation')
plot(c,r,'ro','markersize',60);
function matvisual(A, varargin)
validateattributes(A, {'single', 'double', 'logical'}, ...
{'3d', 'nonempty', 'real'}, ...
if P > 1, subplot(1, P, p), end
himg = imagesc(A(:, :, p));
text(n, m, num2str(A(m, n, p), 3), ...
'FontName', 'Times New Roman', ...
'FontSize', round(6 + 50./sqrt(M.*N)), ...
'HorizontalAlignment', 'center', ...
if strcmp(varargin, 'annotation')
set(gca, 'FontName', 'Times New Roman', 'FontSize', 12)
if P > 1, title(['Matrix page ' num2str(p)]), end
if M <= 50, set(gca, 'YTick', 1:M), end
if N <= 50, set(gca, 'XTick', 1:N), end
cursorMode = datacursormode(gcf);
set(cursorMode, 'UpdateFcn', {@datatiptxt, himg})
function text_to_display = datatiptxt(~, hDatatip, himg)
pos = get(hDatatip, 'Position');
text_to_display = {['Row: ' num2str(pos(2))], ...
['Column: ' num2str(pos(1))], ...
['Value: ' num2str(himg.CData(pos(2), pos(1)))]};