Operation with big files
Afficher commentaires plus anciens
Hi dear all, I have made a similar post but I did not get the answer, I think because I did not explain correctly so I will give it another try, I would really appreciate your support! I have attached 2 files. What I need to do is to take column by column from Amplitudes and reshape them in rows using the numbers from NumberofDofs as size. So for example first number in NumberofDofs is 6, which means I need to extract first 6 values from column 1 from Amplitudes and transpose them in a row. If the size is 2, I extract 2 values from Amplitudes and transpose them in a row and include zeros so I can keep the size for every row as 6. When the first column is done sizing, I would like to do the same with the second column and so on. All this will be printed in a txt file. And why...I have a structure with different degrees of freedom, so if there are 6 Dofs..I need 6 numbers in a row, if there are 2 degrees of freedom, 2 values from Amplitude and 4 extra zeros in a row. Something like this:
%6 Dofs
0.0001 0.0015 0 0.0005 0.0000 0
%2 Dofs
0,00139 0,01788 0 0 0 0
2 commentaires
KSSV
le 24 Nov 2017
There are 50 columns in Amplitudes and 84 numbers for degrees of freedom.....So you want to pick first 50 of 84?
Doina Gumeniuc
le 25 Nov 2017
Réponses (2)
Doina Gumeniuc
le 25 Nov 2017
F = load('Amplitudes.mat').F;
N = load('NumberofDofs.mat').NumDof;
NF = size(F,2);
C = mat2cell(F,N,ones(1,NF));
NN = numel(N);
Nmax = max(N);
result = repmat({zeros(NN,Nmax)},1,NF);
for jj = 1:NF
for kk = 1:NN
result{jj}(kk,1:N(kk)) = C{kk,jj};
end
end
disp(result)
disp(result{1})
Catégories
En savoir plus sur Annotations 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!