No BSD License  

Highlights from
CoCoMac

image thumbnail
from CoCoMac by James Allen
Download CoCoMac.org cortical connectivity data, model it as a network, and simulate epileptic sprea

fc_loadSources()
function [sourceSites, loadError] = fc_loadSources()

% Function to request a text file of sourceSites to load ,
% read it, and return cell array sourceSites
% Text file should contain brain source site names for cocomac - see www.cocomac.org
% One source site per line

loadError = 0;
%=======================================
%==== Request text file and load
%=======================================

[text_name, text_path] = uigetfile('.txt','Select source text file');
textFile = [text_path text_name];

% If the user did not select a file..
if isequal(text_path,0) | isequal(text_name,0)
    errordlg('You must select a text file containing CoCoMac source sites')
    loadError = 1;
    sourceSites = [];
    return;
else
    try
        fid = fopen(textFile);
    catch
        errordlg(['Error - Failed to open text file! ' lasterr])
        loadError = 1;
        sourceSites = [];
        return;
    end
end
%=======================================

%=======================================
% Read into cell array sourceSites
%=======================================

sourceSites = {};
while ( ~ feof(fid))
    string = fscanf(fid,'%s',1);
    sourceSites{end+1, 1} = string;
end
fclose(fid);
%=======================================

return;

Contact us at files@mathworks.com