40 lines
1.3 KiB
Matlab
40 lines
1.3 KiB
Matlab
% Read the lines from the text file
|
|
filename = 'C:\Users\Karthik\Documents\GitRepositories\Calculations\Dipolar-Gas-Simulator\Results\Data_3D\GradientDescent\Phi050\missing_folders.txt'; % replace with your actual file name
|
|
strs = readlines(filename);
|
|
strs = strs(strs ~= ""); % remove empty lines if any
|
|
|
|
% Initialize arrays
|
|
aS = zeros(length(strs),1);
|
|
theta = zeros(length(strs),1);
|
|
phi = zeros(length(strs),1);
|
|
N = zeros(length(strs),1);
|
|
|
|
% Extract numbers using regular expressions
|
|
for i = 1:length(strs)
|
|
tokens = regexp(strs(i), 'aS_(\d+)_theta_(\d+)_phi_(\d+)_N_(\d+)', 'tokens');
|
|
nums = str2double(tokens{1});
|
|
aS(i) = nums(1);
|
|
theta(i) = nums(2);
|
|
phi(i) = nums(3);
|
|
N(i) = nums(4);
|
|
end
|
|
|
|
% Convert to bash-style space-separated strings
|
|
aS_str = sprintf('%d ', unique(aS));
|
|
theta_str = sprintf('%d ', unique(theta));
|
|
phi_str = sprintf('%d ', unique(phi));
|
|
N_str = sprintf('%d ', unique(N));
|
|
|
|
% Trim trailing spaces
|
|
aS_str = strtrim(aS_str);
|
|
theta_str = strtrim(theta_str);
|
|
phi_str = strtrim(phi_str);
|
|
N_str = strtrim(N_str);
|
|
|
|
% Display Bash-compatible output
|
|
fprintf('SCATTERING_LENGTH_RANGE=[%s]\n', aS_str);
|
|
fprintf('POLAR_ANGLE_RANGE=[%s]\n', theta_str);
|
|
fprintf('AZIMUTHAL_ANGLE_RANGE=[%s]\n', phi_str);
|
|
fprintf('NUM_ATOMS_LIST=[%s]\n', N_str);
|
|
|
|
%% |