what does jj = (2016:2023) mean in matlab

The expression jj = (2016:2023) in MATLAB creates a row vector with elements ranging from 2016 to 2023 in steps of one. The resulting vector jj contains seven elements: [2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023].

This syntax can also be used to create a column vector:

main.m
jj = (2016:2023)';
19 chars
2 lines

The apostrophe syntax creates the transpose of the row vector, resulting in a column vector with the same values.

related categories

gistlibby LogSnag