Commit fc7c3e99 authored by Jesse Heckman's avatar Jesse Heckman
Browse files

vPrime update

parent 6db07b65
......@@ -8,15 +8,14 @@ function Dat = pb_vRunVC(signal)
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
dur = 10;
amp = 10;
type = 'sine';
vSignal = pb_vCreateSignal(1, dur, 10, 1, type);
hSignal = pb_vCreateSignal(1, dur, 10, 1, type);
vSignal = pb_vCreateSignal(1, signal(1).duration, 10, 1, signal(1).type);
hSignal = pb_vCreateSignal(1, signal(2).duration, 10, 1, signal(2).type);
Dat.v.x = vSignal.x .* amp;
Dat.v.x = vSignal.x .* signal(1).amplitude;
Dat.v.t = (0:1:length(Dat.v.x)-1)/10;
Dat.h.x = hSignal.x .* 0;
Dat.h.x = hSignal.x .* signal(2).amplitude;
Dat.h.t = (0:1:length(Dat.h.x)-1)/10;
end
......
......@@ -19,24 +19,26 @@ function pb_vRunExp(expinfo,h)
bDat(nblocks) = struct; % pre-allocate data for speed
tDat(nTotTrials) = struct;
set(h.buttonClose, 'Enable', 'off') % avoid closing GUI during executing run function
set(h.buttonRun, 'Enable', 'off');
set(h.buttonLoad, 'Enable', 'off')
set(h.buttonClose, 'Enable', 'off') % avoid closing GUI during executing run function
set(h.buttonRun, 'Enable', 'off');
set(h.buttonLoad, 'Enable', 'off')
%% BODY
% Iterate experiment
for iBlock = 1:nblocks
% Runs blocks of trials with a vestibular condition
nTrials = length(block(iBlock).trial);
signal = block(iBlock).signal;
nTrials = length(block(iBlock).trial);
signal(1) = block(iBlock).signal.ver;
signal(2) = block(iBlock).signal.hor;
updateBlock(h,iBlock,signal);
pb_vSafety(signal); % Checks for safe vestibular parameters!!
bDat(iBlock).signal = pb_vRunVC(signal);
% Plot signals
h.signals; cla; hold on; col = pb_selectcolor(2,2); pause(.1);
h.signals; cla; hold on; col = pb_selectcolor(2,2);
plot(bDat(iBlock).signal.v.t,bDat(iBlock).signal.v.x,'Color',col(1,:));
plot(bDat(iBlock).signal.h.t,bDat(iBlock).signal.h.x,'Color',col(2,:));
......@@ -49,15 +51,16 @@ function pb_vRunExp(expinfo,h)
%pb_vRecordData();
%pb_vRunTrial(experiment(iTrial));
%pb_vFeedbackGUI();
pause(1);
pause(.1);
end
pause(2)
end
%% CHECK OUT
% store data
set(h.buttonClose, 'Enable', 'on');
set(h.buttonRun, 'Enable', 'on');
set(h.buttonLoad, 'Enable', 'on');
set(h.buttonClose, 'Enable', 'on');
set(h.buttonRun, 'Enable', 'on');
set(h.buttonLoad, 'Enable', 'on');
end
function updateBlock(h, iBlock, signal)
......@@ -66,26 +69,19 @@ function updateBlock(h, iBlock, signal)
bn = pb_sentenceCase(num2str(iBlock,'%03d')); % count block
set(h.Bn,'string',bn);
vs = ['V = ' pb_sentenceCase(signal.ver.type) ... % VC stim
', H = ' pb_sentenceCase(signal.hor.type)];
vs = ['V = ' pb_sentenceCase(signal(1).type) ... % VC stim
', H = ' pb_sentenceCase(signal(2).type)];
set(h.Vs,'string',vs);
end
function updateTrial(h, iTrial, cnt, nTotTrials, tDat)
function updateTrial(h, iTrial, cnt, nTotTrials, Dat)
% Updates the trial information to the GUI
h.figure1.Name = ['vPrime - ' num2str(cnt) '/' num2str(nTotTrials)]; % counting title
h.figure1.Name = ['vPrime - ' num2str(cnt) '/' num2str(nTotTrials) ' Trials']; % counting title
tn = num2str(iTrial,'%03d'); % blocktrial
set(h.Tn,'string',tn)
updateDat(h, tDat);
end
function updateDat(h, Dat)
% Updates the visual feedback data
end
......
......@@ -7,20 +7,20 @@ function pb_vSafety(signal)
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
if ~strcmp(signal.hor.type,'none')
if signal.hor.duration > 300
if ~strcmp(signal(2).type,'none')
if signal(2).duration > 300
error('Unsafe signal: Horizontal duration too long!')
end
if signal.hor.amplitude > 20
if signal(2).amplitude > 20
error('Unsafe signal: Horizontal amplitude too large!')
end
end
if ~strcmp(signal.ver.type,'none')
if signal.ver.duration > 300
if ~strcmp(signal(1).type,'none')
if signal(1).duration > 300
error('Unsafe signal: Vertical duration too long!')
end
if signal.ver.amplitude > 50
if signal(1).amplitude > 50
error('Unsafe signal: Horizontal amplitude too large!')
end
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment