필터 지우기
필터 지우기

how can i obtain this?

조회 수: 1 (최근 30일)
RADWAN A F ZEYADI
RADWAN A F ZEYADI 2021년 11월 8일
편집: Cris LaPierre 2021년 11월 8일
HI
ihave data with dimension 153*1 and i want to perform for loop in order to obtain 153*71 where 71 is position along horiziontal axis but i tried to perform it and i got 153*71 but duplicated rows and columns and this is doesnt make sense so how is it linspace function useful for this?
  댓글 수: 3
RADWAN A F ZEYADI
RADWAN A F ZEYADI 2021년 11월 8일
i have obtained from % d_pred = reshape(d_pred(:,1,:),[],1,1);%convert data from 3d to column vector
RADWAN A F ZEYADI
RADWAN A F ZEYADI 2021년 11월 8일
it was 51 71 3

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

답변 (2개)

Cris LaPierre
Cris LaPierre 2021년 11월 8일
편집: Cris LaPierre 2021년 11월 8일
You have not shared your code so it's a little challenging to say what is happening, but if I were to start with a 51x71x3 matrix, and wanted to change it to 153x71, where each column is all the data in the indicated column across all 'sheets', I'd use permute then reshape.
d_pred = rand(51,71,3);
D_pred = permute(d_pred,[1 3 2]);
D_Pred = reshape(D_pred,153,[]);
size(D_Pred)
ans = 1×2
153 71

DGM
DGM 2021년 11월 8일
편집: DGM 2021년 11월 8일
I'm assuming that you want all 71 columns to be extracted in the same fashion. Consider the example:
% 5x5x3 array
A = cat(3,reshape(1:25,5,5),reshape(101:125,5,5),reshape(201:225,5,5))
A =
A(:,:,1) = 1 6 11 16 21 2 7 12 17 22 3 8 13 18 23 4 9 14 19 24 5 10 15 20 25 A(:,:,2) = 101 106 111 116 121 102 107 112 117 122 103 108 113 118 123 104 109 114 119 124 105 110 115 120 125 A(:,:,3) = 201 206 211 216 221 202 207 212 217 222 203 208 213 218 223 204 209 214 219 224 205 210 215 220 225
B = reshape(permute(A,[1 3 2]),[],size(A,2),1) % 15x5 array
B = 15×5
1 6 11 16 21 2 7 12 17 22 3 8 13 18 23 4 9 14 19 24 5 10 15 20 25 101 106 111 116 121 102 107 112 117 122 103 108 113 118 123 104 109 114 119 124 105 110 115 120 125

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by