help
help > RE: batch & multiple between conditions contrasts
Dec 10, 2014 03:12 AM | Alfonso Nieto-Castanon - Boston University
RE: batch & multiple between conditions contrasts
Hi h.
Some thoughts on your questions below
Best
Alfonso
Originally posted by h i:
Creating a cell-array of batch commands is exactly equivalent to just creating different batch variables and running sequentially conn_batch on each of them. The "clear BATCH" line simply makes sure that there is not "carry-over" information from previously created BATCH variables. If your batch script is a script instead of a function, then all of the variables created there are available in Matlab workspace, as opposed to a function-specific workspace, and they will still exist there when you re-run your batch script. For example, the "Cell contents assignment to a non-cell array object" error that you describe arises exactly from this situation, where you had previously defined BATCH as a structure-array (in your previous script), and then you tried to address that same BATCH variable as a cell-array instead. Hope this helps clarify
...
A separate question about the batch process is when I don't specify a contrast at all. The manual states it will run a 2nd-level analysis for each condition. However, my output only gives one 2nd-level result for one condition. It runs the analysis 3 times, but overwrites the results file. Should I just exclude the overwrite command below? Would that provide a results output folder for each condition if I excluded that line?
BATCH.Results.between_subjects.effect_names={'AllSubjects'};
BATCH.Results.between_subjects.contrast=[1];
BATCH.Results.done=1;
BATCH.Results.overwrite='Yes'; %Excluded This line????
BATCH.Results.foldername =conn_results_folder;
Thanks again for all of your help.
I would simply exclude the line:
BATCH.Results.foldername = ...
so CONN will automatically create a different folder for each contrast. Alternatively you may define explicitly your output folders there (but you need to make sure you are defining a different folder for each of your three contrasts/analyses)
Hope this helps
Alfonso
Some thoughts on your questions below
Best
Alfonso
Originally posted by h i:
Alfonso.
Thanks you for reply. I have some more follow-up questions.
I successfully ran a batch script for the entire process, setup, preprocess, analysis, results. In my the script, I called conn_batch twice. I assigned everything to a BATCH (all caps) variable from setup through analysis. Then, I ran the command conn_batch(BATCH). I set up another batch (lower case) variable and then ran the 2nd level analysis with the steps you outlined in your first replay as such for the 3 contrasts with parenthesis and not the curly brackets. In the second batch variable, in included batch(ncondition).Results.filename line specifying the Batch.filename created in the setup. So, that was my work around before I read you latest reply. The output provided the 3 different contrasts, CondA vs CondB, CondA vs CondC, CondB vs CondC.
I tried running the entire script with the curly brackets you suggested in your most recent reply. I received an error message.
Cell contents assignment to a non-cell array object.
Error in batch_conn (line 255)
BATCH{1}.Results.between_subjects.effect_names={'AllSubjects'};
but then I realized you had a clear BATCH line before setting the BATCH{} variables. Is this the step needed to run multiple contrasts? It appears similar to my workaround where I just created a 2nd variable to assign values for my 3 contrasts and calling conn_batch a second time in my script.If so, I would also need to provide the *.mat filename (BATCH{1}.Results.filename ='name_file.mat') containing all of the preproc/setup/analysis/ information, no?
Thanks you for reply. I have some more follow-up questions.
I successfully ran a batch script for the entire process, setup, preprocess, analysis, results. In my the script, I called conn_batch twice. I assigned everything to a BATCH (all caps) variable from setup through analysis. Then, I ran the command conn_batch(BATCH). I set up another batch (lower case) variable and then ran the 2nd level analysis with the steps you outlined in your first replay as such for the 3 contrasts with parenthesis and not the curly brackets. In the second batch variable, in included batch(ncondition).Results.filename line specifying the Batch.filename created in the setup. So, that was my work around before I read you latest reply. The output provided the 3 different contrasts, CondA vs CondB, CondA vs CondC, CondB vs CondC.
I tried running the entire script with the curly brackets you suggested in your most recent reply. I received an error message.
Cell contents assignment to a non-cell array object.
Error in batch_conn (line 255)
BATCH{1}.Results.between_subjects.effect_names={'AllSubjects'};
but then I realized you had a clear BATCH line before setting the BATCH{} variables. Is this the step needed to run multiple contrasts? It appears similar to my workaround where I just created a 2nd variable to assign values for my 3 contrasts and calling conn_batch a second time in my script.If so, I would also need to provide the *.mat filename (BATCH{1}.Results.filename ='name_file.mat') containing all of the preproc/setup/analysis/ information, no?
Creating a cell-array of batch commands is exactly equivalent to just creating different batch variables and running sequentially conn_batch on each of them. The "clear BATCH" line simply makes sure that there is not "carry-over" information from previously created BATCH variables. If your batch script is a script instead of a function, then all of the variables created there are available in Matlab workspace, as opposed to a function-specific workspace, and they will still exist there when you re-run your batch script. For example, the "Cell contents assignment to a non-cell array object" error that you describe arises exactly from this situation, where you had previously defined BATCH as a structure-array (in your previous script), and then you tried to address that same BATCH variable as a cell-array instead. Hope this helps clarify
...
A separate question about the batch process is when I don't specify a contrast at all. The manual states it will run a 2nd-level analysis for each condition. However, my output only gives one 2nd-level result for one condition. It runs the analysis 3 times, but overwrites the results file. Should I just exclude the overwrite command below? Would that provide a results output folder for each condition if I excluded that line?
BATCH.Results.between_subjects.effect_names={'AllSubjects'};
BATCH.Results.between_subjects.contrast=[1];
BATCH.Results.done=1;
BATCH.Results.overwrite='Yes'; %Excluded This line????
BATCH.Results.foldername =conn_results_folder;
Thanks again for all of your help.
I would simply exclude the line:
BATCH.Results.foldername = ...
so CONN will automatically create a different folder for each contrast. Alternatively you may define explicitly your output folders there (but you need to make sure you are defining a different folder for each of your three contrasts/analyses)
Hope this helps
Alfonso
Threaded View
| Title | Author | Date |
|---|---|---|
| h i | Dec 2, 2014 | |
| h i | Dec 15, 2014 | |
| Alfonso Nieto-Castanon | Dec 16, 2014 | |
| h i | Dec 16, 2014 | |
| Alfonso Nieto-Castanon | Dec 17, 2014 | |
| h i | Jan 5, 2015 | |
| Alfonso Nieto-Castanon | Dec 3, 2014 | |
| h i | Dec 3, 2014 | |
| Alfonso Nieto-Castanon | Dec 5, 2014 | |
| h i | Dec 5, 2014 | |
| Alfonso Nieto-Castanon | Dec 10, 2014 | |
