This line considers only all elements of the inputs struct s, when it is a vector:
for i = 1:length(s)
To consider all elements in arrays using linear indexing:
for i = 1:numel(s)
This line considers only all elements of the inputs struct s, when it is a vector:
for i = 1:length(s)
To consider all elements in arrays using linear indexing:
for i = 1:numel(s)
Comment only