There has to be a straightfoward way to do this but I can't find it to save my life:
s = struct([]); s(1).x = 1; s(1).y = 2; s(2).x = -1; s(2).y = -2; [x1, y1] = s(1); % where x1 is initialized to be s(1).x and y1 to be s(1).y
I have a struct with >10 elements. I'd really like to not have to assign variables one line at a time.
Best Answer