This is my day one using Mathematica. What I'm trying to do now is to translate a piece of my Matlab code into Mathematica. Here is an MWE, where I defined a module called coeffs
:
coeffs[n0_] := Module[{n = n0},
c = Table[0, {i, n + 1}, {j, n + 1}]
Do[c[[l + 1, 2]] = 20 , {l, 0, n}]];
I'm trying to use this module as a function in usual sense, which takes a scalar number as input, create an empty matrix, and change the entries in the second column to something else. However, calling this function by coeffs[2]
gives a result of {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}
.
It seems no entries in the second column has been changed. What's the error in my code? Thanks!!