How to use a function like reshape but for indivisible parameters?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to compare two different sets of data containing ozone concentrations, one set I have collected, the other set has been collected by a third party. I have 64 data points and the third party has 12. How can I use a function like reshape to account for the data sets being indivisible between each other?
Flight1O3 = Aug2Flight1.O3_ppb(:); % the column with 64 data entries
Alt_O3 = reshape(Flight1O3, [], 12); % trying to reshape the 64 into 12
0 commentaires
Réponses (1)
Voss
le 4 Juin 2024
You'll have to put some additional elements in the vector for the reshape operation to work:
A = rand(68,1);
N = ceil(numel(A)/12)*12; % next multiple of 12
A(end+1:N) = NaN; % extend A with NaNs to size N
A_new = reshape(A,[],12);
disp(A_new)
A = resize(A,N,'FillValue',NaN); % extend A with NaNs to size N
A_new = reshape(A,[],12);
disp(A_new)
0 commentaires
Voir également
Catégories
En savoir plus sur Cell Arrays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!