Hello Francois,
when I right click on a trial to export it to matlab I get a menu like the attachment (see below)
but if I right click on more than one trials from the same condition I am getting no option to export anything…would it be possible to change this?
If I am not mistaken, currently, 100 trials imply 100 manual matlab exports.
Also, when I export a single trial I get a workspace struct that looks like this style: Trial_No.F(:,
would it be possible to make the export variable look something like this?
Subject_Name.Condition_Name.Trial_No.F(:, ?
Best Regards,
Leo
Hi Leo,
This menu “export to Matlab” exists only to access very quickly to what is in a given file, for testing or changing something, it’s not meant to be used for intensive processing.
If you want to loop over 100 files, you should write a small script. Example:
sStudy = bst_get('StudyWithCondition', 'Subject01/Right');
for i = 1:length(sStudy.Data)
DataMat = in_bst_data(sStudy.Data(i).FileName);
% Alternative: DataMat = load(file_fullpath(sStudy.Data(i).FileName));
end
I am trying to understand the general format of this code, can you walk me through it? I am going to try to interpret it, if you see any errors - please let me know.
sStudy = bst_get('StudyWithCondition', 'Subject01/Right');
this line creates a variable, defined by ('the protocol's name', 'the subject / the segmented data structure')
for i = 1:length(sStudy.Data)
this line establishes the for loop with the parameters of the # of segments of data for the subject
DataMat = in_bst_data(sStudy.Data(i).FileName);
this line converts the each segment of data for the subject to .mat
end
Is this correct? If so, then if I wanted to set it to run this for all 100 of my subjects, would I create an outer for loop to run this through every subject?
You may have noticed that now it is possible to "Export to Matlab" multiple selected files at once, but I guess this is not the purpose of your question.