필터 지우기
필터 지우기

I generated 3 (1X1) random numbers using a=rand(1,1,3). When I gave [b n] =shiftdim(a), I got a b matrix of 3X1 matrix using the elements of variable a and got the n value as 2. Can u explain the concept behind this and how the value of “n” is det

조회 수: 1 (최근 30일)
I generated 3 (1X1) random numbers using a=rand(1,1,3). When I gave [b n] =shiftdim(a), I got a b matrix of 3X1 matrix using the elements of variable a and got the n value as 2. Can u explain the concept behind this and how the value of “n” is determined?

답변 (1개)

Jan
Jan 2013년 7월 5일
편집: Jan 2013년 7월 5일
This is explained exhaustively in the documentation, so please read:
help shiftdim
doc shiftdim
Another good idea is to look into the source code:
edit shiftdim
You'll find out, that n replied by shiftdim is the number of dimensional shifts, which is required to bring the first non-signelton dimension (the first one which has not the length 1) to the front. In your case, 2 means, that the 3rd dimension is shifted twice to get the 1st one.

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by