len_ymas <- calc_growth(c(30, 40), c(0.4, 0.2), c(-1, -1))
# Calculate stock weight at age
a_s <- rep(1e-6, 2)
b_s <- c(3, 3.1)
ns <- length(a_s)
swt_ymas <- sapply(1:ns, function(s) {
a_s[s]*len_ymas[, , , s]^b_s[s]
}, simplify = "array")
Run the code above in your browser using DataLab