mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
Add option to return flattened data object
Related to issue #31 because it moves a utility function into the core library.
This commit is contained in:
parent
f5a7c09493
commit
1a3ca8cc69
@ -83,12 +83,19 @@
|
|||||||
|
|
||||||
// core.data returns all of the data objects for each block as an array
|
// core.data returns all of the data objects for each block as an array
|
||||||
// where core.data[0] = data object from block 0, etc...
|
// where core.data[0] = data object from block 0, etc...
|
||||||
|
// if flatten is true, then the hierarchical structure of the data
|
||||||
|
// is removed and each array entry will be a single trial.
|
||||||
|
|
||||||
core.data = function() {
|
core.data = function(flatten) {
|
||||||
var all_data = [];
|
var all_data = [];
|
||||||
for (var i = 0; i < exp_blocks.length; i++) {
|
for (var i = 0; i < exp_blocks.length; i++) {
|
||||||
all_data[i] = exp_blocks[i].data;
|
all_data[i] = exp_blocks[i].data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(flatten===true){
|
||||||
|
all_data = flattenData(all_data);
|
||||||
|
}
|
||||||
|
|
||||||
return all_data;
|
return all_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user