function [A_data1,A_data2,A_data3,icasig_data1,icasig_data2,icasig_data3] = ICA_3datasets(data1,data2,data3,numICs_data1,numICs_data2,numICs_data3)
%% ICA on each dataset separately

% Inputs:
%
% 1. data1 - 2D matrix (subjects by volume) for the 1st dataset
% 2. data1 - 2D matrix (subjects by volume) for the 1st dataset
% 3. data1 - 2D matrix (subjects by volume) for the 1st dataset
% 4. numICs_data1 - number of Sources (components by volume) for the 1st dataset
% 5. numICs_data1 - number of Sources (components by volume) for the 2nd dataset
% 6. numICs_data1 - number of Sources (components by volume) for the 3rd dataset

% Optional inputs:
%
% 1. numRuns - Number of runs

% Outputs:
% 1. A_data1 - estimated mixing matrix (components by components) for the 1st dataset
% 2. A_data2 - estimated mixing matrix (components by components) for the 2nd dataset
% 3. A_data3 - estimated mixing matrix (components by components) for the 3rd dataset
% 4. icasig_data1 - sources (components by volume) for the 1st dataset
% 5. icasig_data2 - sources (components by volume) for the 2nd dataset
% 6. icasig_data3 - sources (components by volume) for the 3rd dataset

if ~exist('numRuns', 'var')
    numRuns = 30;
end
[A_data1,icasig_data1] = separateICA(data1,numICs_data1,numRuns);
[A_data2,icasig_data2] = separateICA(data2,numICs_data2,numRuns);
[A_data3,icasig_data3] = separateICA(data3,numICs_data3,numRuns);