Operation with big files
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
KSSV
2017-11-24
There are 50 columns in Amplitudes and 84 numbers for degrees of freedom.....So you want to pick first 50 of 84?
回答(2 个)
Voss
2024-6-25
编辑:Voss
2024-6-25
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})
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!