(adsbygoogle = window.adsbygoogle || []).push({}); Building a matrix using "while" loops? (MATLAB)

Hello

Here is my code:

a,b,c are all 11x11 matrices and Test1 is a function m-file which outputs a number. (I have tested it for all the values that a(i,j), b(i,j) and c(i,j) take).Code (Text):

i = 1;

j = 1;

S = zeros(11,11);

while i < 12

while j < 12

S(i,j) = Test1(a(i,j),b(i,j),c(i,j));

j = j + 1;

end

i = i + 1;

end

My code is only calculating the first row of S, ie. S(2,1) = 0 still. I don't know why the program is ending without adding 1 onto i and repeating the loop, I can only imagine the "while" loop is the wrong way of going about this?

Thanks for any help,

Mike

**Physics Forums - The Fusion of Science and Community**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Building a matrix using while loops? (MATLAB)

Loading...

Similar Threads - Building matrix using | Date |
---|---|

Mathematica Summing matrix components | Thursday at 3:56 PM |

Eigenvectors 4x4 Matrix in Mathematica | Aug 26, 2017 |

How to build a non-uniform initial temperature with Matlab and COMSOL-thanks | Nov 16, 2011 |

**Physics Forums - The Fusion of Science and Community**