3 plane to array vectorization

조회 수: 1 (최근 30일)
Raviteja
Raviteja 2011년 9월 7일
I have data in a matrix Atr
>> whos Atr
Name Size Bytes Class Attributes
Atr 7x3x2500 420000 double
I want to extract Atr(1,1,:) into a row vector Q. I tried like this
>>Q=Atr(1,1,:);
>> whos Q
Name Size Bytes Class Attributes
Q 1x1x2500 20000 double
But I need to store in a signle rwo vector . And also tried in this way
for i=1:2500
Q(i)=Atr(1,1,i);
end
>> whos Q
Name Size Bytes Class Attributes
Q 1x1x2500 20000 double
But no help. How can I store in a single row vector ?

채택된 답변

Grzegorz Knor
Grzegorz Knor 2011년 9월 7일
doc squeeze
Q=squeeze(Atr(1,1,:));
  댓글 수: 2
Grzegorz Knor
Grzegorz Knor 2011년 9월 7일
Another possibility:
Q = Atr (1,1,:);
Q = Q (:);
Raviteja
Raviteja 2011년 9월 7일
these are not working...
Above squeeze working....

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

추가 답변 (1개)

Andrei Bobrov
Andrei Bobrov 2011년 9월 7일
Q = reshape(Atr(1,1,:),1,[])
variant for all matrix Atr
n = size(Atr);
Qarray = reshape(Atr,n(1)*n(2),[]);

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by