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!