diff --git a/js/psychojs/data.js b/js/psychojs/data.js old mode 100644 new mode 100755 index f3b8850..b8de2ad --- a/js/psychojs/data.js +++ b/js/psychojs/data.js @@ -131,6 +131,64 @@ psychoJS.data.TrialHandler = function(attribs) { this.finished = false; this._experimentHandler = null; + this.sequenceIndices = psychoJS.data.makeIndices(this.trialList.length,this.nReps); + this.trialSequence = psychoJS.data.makeSequence(this.sequenceIndices, this.method); +} + +psychoJS.data.makeIndices = function(nt,nr){ +/* + make a 2 dimensional array nReps x trialList.length + of indices into the trialList array +*/ + var seq, temp, r, n + seq = []; + for (r=0;r 0) csv = csv + ', '; @@ -340,9 +405,9 @@ psychoJS.data.ExperimentHandler.prototype.save = function(attribs) { // (b) build the records: for (var r = 0; r < this._trialsData.length; r++) { for (var h = 0; h < header.length; h++) { - if (h > 0) - csv = csv + ', '; - csv = csv + this._trialsData[r][header[h]]; + if (h > 0) csv = csv + ', '; + // leave 'undefined' values blank in the data file + if (typeof(this._trialsData[r][header[h]]) != 'undefined') csv = csv + this._trialsData[r][header[h]]; } csv = csv + '\n'; }