Created basic structure of function

This commit is contained in:
sakul-45 2021-07-04 21:00:36 +02:00
parent cea5e1367e
commit 3c66006505

View File

@ -1,7 +1,42 @@
function [outputArg1,outputArg2] = correct_time_baseline(inputArg1,inputArg2) function [dataOUT] = correct_time_baseline(dataIN)
%CORRECT_TIME_BASELINE Summary of this function goes here %CORRECT_TIME_BASELINE Summary of this function goes here
% Detailed explanation goes here % Detailed explanation goes here
outputArg1 = inputArg1;
outputArg2 = inputArg2; %Create figure
f = figure('Units','Normalized',...
'Position',[.3 .3 .4 .4],...
'NumberTitle','off',...
'Name','Choose Pretrigger');
%input field
inp = uicontrol('Style','Edit',...
'Units','Normalized',...
'Position',[.025 .025 .7 .05],...
'Tag','myedit');
%"Done" button
p = uicontrol('Style','PushButton',...
'Units','Normalized',...
'Position',[.75 .025 .225 .05],...
'String','Done',...
'CallBack','uiresume(gcbf)');
%axes for plot
ax = axes(f,'Units','Normalized',...
'Position',[.05 .125 .925 .85]);
%plot current data in figure
plot(ax,dataIN)
axis tight
%wait until button pressed
uiwait(f)
pretrigger = str2double(get(inp,'String'));
%timeline CORRECTING
data_size = size(dataIN);
dataOUT = zeros(data_size);
for n = 1:data_size(2)
column_mean = mean(dataIN(1:pretrigger,n));
dataOUT(:,n) = dataIN(:,n) - column_mean;
end
%plotting result
plot(ax,dataOUT)
axis tight
end end