필터 지우기
필터 지우기

What is the name of the operation X(:)

조회 수: 21 (최근 30일)
Björn
Björn 2014년 8월 20일
편집: Matt J 2014년 8월 20일
I came across some code at work where they use X(:). It appears that this command rearranges the matrix. If I have a matrix X of size (M, N), then X(:) is of size (M*N,1).
What is the name of this operation? What can I search for?
I'm curious to read about it. One thing I want to check is if I can find an easy way to get the (M,N)-sized matrix back.
Thanks!

채택된 답변

Guillaume
Guillaume 2014년 8월 20일
  댓글 수: 2
Björn
Björn 2014년 8월 20일
Thanks!
Guillaume
Guillaume 2014년 8월 20일
Note that if you want to get the original matrix back, reshape is the function:
reshape(X(:), M, N)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Matt J
Matt J 2014년 8월 20일
편집: Matt J 2014년 8월 20일
What is the name of this operation? What can I search for?
As it happens, the name of the operation and where you can read about it are two different things. Although X(:) is described under "doc colon", it is really a subsref operation,
>> X=rand(5,4);
>> S.type='()'; S. subs={':'};
>> isequal(X(:), subsref(X,S) )
ans =
1

카테고리

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