Try replacing numel(num_days) with num_days, i.e.:
figure % make new figure
tiledlayout(num_days, 1, 'TileSpacing','compact', 'Padding', 'compact');
range_col = 800; % range upper limit for my values
for day = 1:num_days
     % your code
end
          
Try replacing numel(num_days) with num_days, i.e.:
figure % make new figure
tiledlayout(num_days, 1, 'TileSpacing','compact', 'Padding', 'compact');
range_col = 800; % range upper limit for my values
for day = 1:num_days
     % your code
end
          Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!