I'm fairly new to the use of arrays and matrices in general. I'm in the crane design industry and modern codes require multiple load combinations to be analysed in structural calculations simultaneously. Codes then often pose choices based on things like stress ratios. For example, in it's simplest form, a different set of rules are required if a stress is in compression rather than in tension. I need the ability to automatically differentiate between these stresses, and the correct rules are applied for each load combination. Sometimes these problems may use array sizes in the hundreds. I've attached a very basic programme. My desired outcome is a single n x 1 array. What I tend to get is an array of nested arrays. I've played around and found that if I were to transpose this and turn the nested array into a single clean matrix, use the diagonal function, then this would give me what I need. I have no idea how to do this though. Help would be greatly appreciated.