Home › Forums › General Help › Scripting
This topic contains 1 reply, has 2 voices, and was last updated by Mite Mijalkov 2 days, 22 hours ago.

AuthorPosts

Thomas HinaultHi Mite,
I have another question regarding Braph analyses. Could you please provide a quick example on how to script the analyses? I would like to compute braph metrics on many conditions (with the same parameters in the algorithms) and it would be faster to run these analyses within a FOR loop.Thanks!
Thomas
Hi Thomas,
In the following, I will try to provide an explanation for the process of how to script a sample analysis. I will assume that you have your cohort ready and saved. A sample procedure for the analysis would be the following:
% this loads the fc cohort file
load(‘trial_cohort.fc’,’mat’)
% in here if you type cohort on the command line, you can see all the cohort properties and subject division into groups% the data of a specific group can be extracted as:
data = cohort.getSubjectData(group1);
% this is a cell array containing the data for all subjects% specify the density range at which measures will be calculated
densities = density_min:density_step:density_max;% specity the measures that should be calculated
measures = [1 2 3 4 5];
% the measures should be put by their corresponding numbers (the numbers represent the order of the measure in the list, it can be found by typing Graph.NAME)% now the measures should be calculated for each density for each subject (in that particular group)
% a sample for loop would look like
for subi % for each subject in the corresponding group
for d% for each density specified
graph = GraphBU(data{subi,d},’Density’,d); % create the graph (BU)
for meas % for each measure specified
try
r = graph.measure(meas);
catch
r = 0;
end
end
end
endI really hope that this helps. However, if you need something more, or something more specific, please let me know what you need and I will try to help you with scripting those codes.
Best,
Mite 
AuthorPosts