close all; clear; clc

data = rand(1e4);

tic
m = max(max(data));
toc

clear m

tic
m = max(data(:));
toc

clear m

tic
m = max(data, [], "all");
toc