3 plane to array vectorization

1 Ansicht (letzte 30 Tage)
Raviteja
Raviteja am 7 Sep. 2011
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 ?

Akzeptierte Antwort

Grzegorz Knor
Grzegorz Knor am 7 Sep. 2011
doc squeeze
Q=squeeze(Atr(1,1,:));
  2 Kommentare
Grzegorz Knor
Grzegorz Knor am 7 Sep. 2011
Another possibility:
Q = Atr (1,1,:);
Q = Q (:);
Raviteja
Raviteja am 7 Sep. 2011
these are not working...
Above squeeze working....

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Andrei Bobrov
Andrei Bobrov am 7 Sep. 2011
Q = reshape(Atr(1,1,:),1,[])
variant for all matrix Atr
n = size(Atr);
Qarray = reshape(Atr,n(1)*n(2),[]);

Kategorien

Mehr zu Numerical Integration and Differential Equations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by