MATLAB: How to loop into a matrix

matrix loop

I have six values of E and v which are entries of Matrix s of the structure; s=[1/E -v/E 0; v/E 1/E 0; 0 0 2*(1+v)/E]
the six matrices of s formed are the entry into the matrix S; S=[s(1) s(2) s(3) s(4) s(5) s(6)]
How can I loop the values of E and v into the matrix s?

Best Answer

I assume you are trying to do something like
for ii = 1:6
S{ii} = [1 -v(ii) 0; v(ii) 1 0; 0 0 2*(1+v(ii))]/E(ii);
end
Note that S is a cell array, so your first matrix (your s(1)) would be accessed as S{1}.