As expected, your code returned the error
Unable to perform assignment because the size of the left side is 3-by-1 and the size of the right side is 6-by-1.
...because of reasons already listed multiple times in the comments.
You can solve this by storing the data in a cell array.
T=readtable('b.xlsx');
b=table2array(T);
pks=cell(21,1);
for i=1:21
pks{i}=findpeaks(b(:,i))
end
pks =
21×1 cell array
{6×1 double}
{6×1 double}
{6×1 double}
{6×1 double}
{7×1 double}
{6×1 double}
{5×1 double}
{7×1 double}
...
Best Answer