function [activ activLabels net netLabels data circularPositions] = fc_loadActiv(fig_id, activ_plot_axes, circular_plot_axes, time_plot_axes)
% Function to load previously saved data:
% activ, activLabels: activity matrix and labels
% net, netLabels: connectivity matrix and labels
% data: full data structure - startNode, sArea, sHemisphere sPDC sEC_source sPDC2 sLaminae
% endNode tArea tHemisphere tPDC tEC_source tPDC2 tLaminae fibreDensity course
% circularPositions: coordinates for circular connectivity plot
[activation_name, activation_path] = uigetfile('.mat','Select .mat file containing activation data');
activationData = [activation_path activation_name];
% If the user did not select a file..
if isequal(activation_path, 0) | isequal(activation_name,0)
errordlg('You must select a .mat file')
activ = [];
data = [];
net = [];
netLabels = [];
return;
else
try
load (activationData);
catch
errordlg(['Error opening .mat file :' lasterr])
activ = [];
data = [];
net = [];
netLabels = [];
return;
end
end
if exist('activ') == 0 | exist('data') == 0 | exist('net') == 0 | exist('netLabels') == 0 | exist('activLabels') == 0
errordlg('Error - activ, data, net or netLabels not found!')
activ = [];
data = [];
net = [];
netLabels = [];
return;
end
fc_clearGUI(fig_id, activ_plot_axes);
% Set the list boxes
fc_set_nodeList(unique({data.startNode}), startNodes, removeNodes, fig_id);
% Plot circular graph, return the positions of nodes for further plotting (animation)
circularPositions = fc_plotCircle(net, netLabels, circular_plot_axes);
% Make sure animation panel and activ axes are visible
set(activ_plot_axes, 'visible', 'on');
set(findobj(fig_id, 'tag', 'panel_animation'), 'visible', 'on');
% Set the alpha value in GUI to the square root of no. of areas (no. of
% areas is calculated by length(netLabels) )
set(findobj(fig_id, 'tag', 'alpha_editbox'), 'string', num2str(sqrt(length(netLabels))));
fc_plot_activ(activ, activ_plot_axes);
fc_plot_time(activ, time_plot_axes);
% MAke an entry in GUI_log.txt
fc_saveLog(['Loaded simulation data from: ' activationData]);