Large dataset in loop and save results in a variable
古いコメントを表示
I have a large dataset. where I have 25million rows, I will be using 1-250,000, 1-500,000 and so on. I wrote the code, but the vaiable in the dielectricconstant is not saving properly. I have the below code, I think its just need a little tweak.
clc
clear all
T= 298.5; % temperature
Kb= 1.38065E-23; %Boltzman's Constant
e0= 8.85418*10^(-12); % permittivity in vacuum
e=(1.603*(10^-19))^2; % charge of electron
vol = 35.627171 * 35.627171 * 35.627171*10^(-30);
M = importdata('Trial-1-SPCE.dipole.Pw');
n = length(M); % number of rows
%A = M(1:2:end,:); % odd matrix--Dipole moment matrix
for n = 250000:250000:25000001
DielectricConstant = [];
for i = 1:100
A = M(1:n,:);
P = [A(:,3)+ A(:,4)+ A(:,5)];
Q= (mean(P))^2; %ensemble average square
P1= [A(:,3).^2+ A(:,4).^2+ A(:,5).^2];
Q1= (mean(P1)); %mean of square of dipole moment
MM= Q1-Q;
scale = e*(10^(-20))/(3*e0*Kb*T*vol);
DielectricConstant(i)= MM*scale;
end
end
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!