Solved it myself with an if else statement, see code below.
for i = 1:N_run
    for t = 1:length(col)
        if cellfun(@isempty,iwant2(:,:,t,i))
            vx_avr{t,i} = zeros(Nz2,Nx2);
            vz_avr{t,i} = zeros(Nz2,Nx2);
        else
        vx_avr{t,i} = cellfun(@(x)mean(x(:,1)),iwant2(:,:,t,i));
        vz_avr{t,i} = cellfun(@(x)mean(x(:,2)),iwant2(:,:,t,i));
        end
    end
end
Thank you Adem Danz for your suggestions, it really helped me in finding the final solution to this problem.







