필터 지우기
필터 지우기

Why do we usually use M,N,P to indicate dimensions?

조회 수: 10 (최근 30일)
Vitaly
Vitaly 2011년 7월 28일
taken to indicate the dimension of the array m, n, p. the meaning of these letters I guess that m - main n -??? p - page?

답변 (2개)

Paulo Silva
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
Paulo Silva
Paulo Silva 2011년 7월 28일
just variables, no particular meaning, use the variables you like the most
Walter Roberson
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
karthika 2011년 7월 28일
m and p gives the number of rows and columns
  댓글 수: 2
Vitaly
Vitaly 2011년 7월 28일
as I know m and n gives the number of rows and columns, is any advantage to use p for columns due the best perfomance?
Walter Roberson
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 CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by