Ask your own question, for FREE!
Computer Science 53 Online
OpenStudy (alexrobin13):

Need help with MatLab coding (Will medal) I'm trying to code for Pascal's triangle (quick Google will explain it). My code is: function[P]=Pascales(n) for i=1:n B(i, 1)=1 for i=2:n for j=2:n B(i,j)=B(i-1,j)+B(i-1,j-1) end end end But I keep getting the error: Index exceeds matrix dimensions. Error in Pascales (line 7) B(i,j)=B(i-1,j)+B(i-1,j-1) Please help.

OpenStudy (rsmith6559):

Are there supposed to be commas between i and j inside the parentheses?

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!