# Operation with big files

5 vues (au cours des 30 derniers jours)
Doina Gumeniuc le 23 Nov 2017
Modifié(e) : Voss le 25 Juin 2024
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 commentairesAfficher AucuneMasquer Aucune
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
Hi! Not really, there are 50 columns (for 50 different frequencies), each column has 453 degrees of freedom. In number of Dofs, there are different values: 6,6 and so on....I want to pick up from 453 that number of values..which is written in number of Dofs, in the same order. I want the same procedure for each of those 50 columns with 453 lines each

Connectez-vous pour commenter.

### Réponses (2)

Doina Gumeniuc le 25 Nov 2017
I have managed to do it for one column (please see attached). But I do not know how to make it for all 50 columns without me having to do it for each individually. This is what I used
F1=Ccell{1,1}(:,1);
F1_cell=mat2cell(F1,NumDof,size(F1,2));
F1_inside=cellfun(@transpose,F1_cell,'UniformOutput',false);
F1_lng=max(cellfun(@length,F1_inside));
za=zeros(1,F1_lng);
for k=1:length(F1_inside)
cellVal=F1_inside(k);
cellVal=F1_inside{k};
if length(cellVal)<F1_lng
F1_inside{k}=za;
F1_inside{k}(1:length(cellVal))=cellVal;
end
end
Freq1=cell2mat(F1_inside);
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

Voss le 25 Juin 2024
Modifié(e) : Voss le 25 Juin 2024
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)
Columns 1 through 10 {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} Columns 11 through 20 {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} Columns 21 through 30 {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} Columns 31 through 40 {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} Columns 41 through 50 {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double} {84x6 double}
disp(result{1})
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.0000 0 0 0 0 0 0 0 0 0 0 0 1.0000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0083 0 0 0 0 0 0.0083 0 0 0 0 0 0 0 0 0 0 0 0.0083 0 0 0 0 0 0.0083 0 0 0 0 0 0.0083 0 0 0 0 0 0.0083 0 0 0 0 0 0.0083 0 0 0 0 0 0.0083 0 0 0 0 0 0 0 0 0 0 0 0.0083 0 0 0 0 0 0.0083 0 0 0 0 0 0.0083 0 0 0 0 0 0.0083 0 0.0106 0 0 0 0.0083 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0004 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0231 0 0.0001 0 0.0083 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0314 0 0.0000 0 0.0083 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0572 0 0.0007 0 0.0083 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1005 0 0.0007 0 0.0083 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1604 0 0.0002 0 0.0083 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2244 0 0.0000 0 0.0083 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2826 0 0.0016 0 0.0083 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3333 0 0.0038 0 0.0083 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3774 0 0.0071 0 0.0083 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4148 0 0.0108 0 0.0083 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4447 0 0.0146 0 0.0083 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4687 0 0.0180 0 0.0083 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4853 0 0.0204 0 0.0083 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4911 0 0.0212 0 0.0083 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4990 0 0.0224 0 0.0083 0 0 0 0 0 0 0 0 0 0 0 0 0
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur File Compression 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!

Translated by