How can I integrate and index function output into dynamic field names?
Say function y=fun(x) outputs an array of integers.
How can I implement:
Varnames=['var1' 'var2' 'varx' 'vary'];
TestStruct.(Varnames(index(fun(x),3))) = 0;
that is equivalent to: (for instance)
or better yet, if varx is an array, a way to make it equivalent to:
Is there a way to tell a function that you are only interested int the nth element?
Thanks in advance,