% This script is provided "as is", and the authors are not responsible
% whatsoever for the outcomes of this script or any modification.		
% The usage of the script in any publication should be acknowledged by citing:
% Barbieri L, Luchinat E, "Monitoring Protein-Ligand Interactions in Human 
% Cells by Real-Time Quantitative In-Cell NMR using a High Cell Density 
% Bioreactor", Journal of Visualized Experiments.
% ---------------------------------------------------

%choose NMR dataset
folder = uigetdir();

% Load ascii file info for each spectrum (output of convbin2asc)
filelist = dir(fullfile(folder, '\*\pdata\1\ascii-spec.txt')); 

% Get full path names for each text file
file_paths = fullfile({filelist.folder}, {filelist.name});
% file_paths will contain only the paths where 'ascii-spec.txt' is present

% Read data from files, keep second column
for i = 1 : numel(file_paths)
spectrum = textread(file_paths{i}, '', 'delimiter', ',');

% Save second data column to matrix
spectra(i, :) = spectrum(:, 2);
end

% Save chemical shift values
cs = spectrum (:, 1);
