Assign a letter to a set of (for example) real numbers?

I am going through a book which is teaching the basics of m files, and one loop they have done is:
for i = 1:m
for j = 1:n
A(i,j) = a/(i + j - 1);
end
end
A
However matlab doesn't understand what " i = 1:n" means, and neither do I. I am guessing it is the set of all real numbers or integers from 1 to n, but maybe because it hasn't been set, matlab doesn't know what it is?
How would I fix this?

 Accepted Answer

No, the problem is that n, m & a are unknowns!
set for example
n=2;
m=2;
a=10
for i = 1:m
for j = 1:n
A(i,j) = a/(i + j - 1);
end
end

More Answers (2)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!