Why do we usually use M,N,P to indicate dimensions?
10 次查看(过去 30 天)
显示 更早的评论
taken to indicate the dimension of the array m, n, p. the meaning of these letters I guess that m - main n -??? p - page?
0 个评论
回答(2 个)
Paulo Silva
2011-7-28
They are just variables when used like this:
[m,n,p] = size(rand(2,3,4))
m holds the first dimension (the number of rows)
n holds the second dimension (the number of columns)
p holds the third dimension of the array, think about it like the number of pages
4 个评论
Walter Roberson
2011-7-28
Historical habit in mathematics, just like using the beginning of the alphabet to represent constants and using the end of the alphabet to represent variables.
karthika
2011-7-28
m and p gives the number of rows and columns
2 个评论
Walter Roberson
2011-7-28
No. The programming language doesn't care which variable name you use, but you will lose efficiency from people reading your code and attempting to figure out what your names mean. If you are going to use non-traditional names, use names that are self-explanatory.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!