how can i obtain this?
Afficher commentaires plus anciens
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 commentaires
You haven't described what is actually being done. You have 153x1 data that you want turned into 153x71 data, but not by column replication. If not by column replication, what are the other columns supposed to be? Are they linearly increasing? Decreasing? Something else?
In other words:
x = 1:71;
y = % 153x1 column vector
z = % 153x71 array representing some undescribed function of x and y
RADWAN A F ZEYADI
le 8 Nov 2021
RADWAN A F ZEYADI
le 8 Nov 2021
Réponses (2)
Cris LaPierre
le 8 Nov 2021
Modifié(e) : Cris LaPierre
le 8 Nov 2021
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)
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))
B = reshape(permute(A,[1 3 2]),[],size(A,2),1) % 15x5 array
Catégories
En savoir plus sur Matrices and Arrays dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!