Skip to content

Commit bac82de

Browse files
committed
plotting macro currents
1 parent 1c5cfea commit bac82de

1 file changed

Lines changed: 64 additions & 15 deletions

File tree

Analysis/SK/Scripts-in-progress/Sim_Distance_Comparison.m

Lines changed: 64 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
simPath = 'C:\Users\Sammy\Dropbox\Goodman Lab\Posters Papers Proposals\2018-Katta-SpatiotemporalDynamics\source-data\sim-channel-distance\';
1010
simFiles = {'channel-distance-displacement.xlsx','channel-distance-speed.xlsx','channel-distance-frequency.xlsx'};
1111
simData = cell(0);
12-
for i = 1:3
13-
[~,~,simData{i}] = xlsread(fullfile(simPath,simFiles{i}));
14-
simData{i} =
12+
simDataMat = cell(0);
13+
for iPanel = 1:3
14+
[~,~,simData{iPanel}] = xlsread(fullfile(simPath,simFiles{iPanel}));
15+
simDataMat{iPanel} = cell2mat(simData{iPanel}(2:end,:));
1516
end
1617

1718
recData = cell(0);
@@ -28,8 +29,8 @@
2829
% figure('Position',[200 200 800 600]);
2930

3031
for iPanel = 1:3
31-
fh(iPanel,1) = figure('Position',[500 100 800 600]);
32-
fh(iPanel,2) = figure('Position',[100 100 600 600]);
32+
fh(iPanel,1) = figure('Position',[100 100 600 600]); % stim and macro currents
33+
fh(iPanel,2) = figure('Position',[500 100 800 600]); % channel currents
3334

3435
switch iPanel
3536
case 1 % displacement
@@ -45,34 +46,82 @@
4546

4647
% find all subsets of columns now, use overlap in indices later to pull
4748
% out more specific subsets
48-
stimCols = find(~cellfun(@isempty,cellfun(@(x) regexp(x,'^stim'),simHeaders,'un',0)));
49-
currTotCols = find(~cellfun(@isempty,cellfun(@(x) regexp(x,'^currTot'),simHeaders,'un',0)));
50-
chCurrCols = find(~cellfun(@isempty,cellfun(@(x) regexp(x,'^chcurr'),simHeaders,'un',0)));
51-
onCols{1} = find(~cellfun(@isempty,cellfun(@(x) regexp(x,'_on'),simHeaders,'un',0)));
52-
onCols{2} = find(~cellfun(@isempty,cellfun(@(x) regexp(x,'_off'),simHeaders,'un',0)));
49+
stimCols = ~cellfun(@isempty,cellfun(@(x) regexp(x,'^stim'),simHeaders,'un',0));
50+
currTotCols = ~cellfun(@isempty,cellfun(@(x) regexp(x,'^currTot'),simHeaders,'un',0));
51+
chCurrCols = ~cellfun(@isempty,cellfun(@(x) regexp(x,'^chcurr'),simHeaders,'un',0));
52+
onCols{1} = ~cellfun(@isempty,cellfun(@(x) regexp(x,'_on'),simHeaders,'un',0));
53+
onCols{2} = ~cellfun(@isempty,cellfun(@(x) regexp(x,'_off'),simHeaders,'un',0));
5354

5455
intTypes = cellfun(@(x) regexp(x,sprintf('_%s(\\S{1,5})',stType),'tokens'),simHeaders,'un',0);
5556
intTypes = [intTypes{:}];intTypes = [intTypes{:}];
5657
intTypes = unique(intTypes,'stable');
5758
for jIntensity = 1:length(intTypes);
58-
intCols{jIntensity} = find(~cellfun(@isempty,cellfun(@(x) regexp(x,sprintf('_%s%s$',stType,intTypes{jIntensity})),simHeaders,'un',0)));
59+
intCols{jIntensity} = ~cellfun(@isempty,cellfun(@(x) regexp(x,sprintf('_%s%s$',stType,intTypes{jIntensity})),simHeaders,'un',0));
5960
end
6061

6162
distTypes = cellfun(@(x) regexp(x,'_dist(\S{1,4})_','tokens'),simHeaders,'un',0);
6263
distTypes = [distTypes{:}];distTypes = [distTypes{:}];
6364
distTypes = unique(distTypes,'stable');
6465
for kDist = 1:length(distTypes);
65-
distCols{kDist} = find(~cellfun(@isempty,cellfun(@(x) regexp(x,sprintf('_dist%s_',distTypes{kDist})),simHeaders,'un',0)));
66-
end
67-
68-
% NEXT: make subplots and start matching subsets for each subplot
66+
distCols{kDist} = ~cellfun(@isempty,cellfun(@(x) regexp(x,sprintf('_dist%s_',distTypes{kDist})),simHeaders,'un',0));
67+
end
68+
69+
% make subplots, match column subsets for each subplot, and plot
6970
for jIntensity = 1:length(intTypes)
71+
figure(fh(iPanel,1));
7072

73+
if strcmp(stType,'disp') || strcmp(stType,'speed') % plot on and off
74+
% plot stimulus traces
75+
axh1(jIntensity,1) = subplot(3,3,1+3*(jIntensity-1));
76+
thisCol = sum([stimCols; intCols{jIntensity}; onCols{1}],1)==3;
77+
plot(simTime, simDataMat{iPanel}(:,thisCol),'b'); % on = blue
78+
hold on;
79+
thisCol = sum([stimCols; intCols{jIntensity}; onCols{2}],1)==3;
80+
plot(simTime, simDataMat{iPanel}(:,thisCol),'m'); % off = magenta
81+
82+
% plot experimental total current
83+
axh1(jIntensity,2) = subplot(3,3,2+3*(jIntensity-1));
84+
% separate exp traces into aligned on and off for plotting
85+
86+
% plot simulated total current
87+
axh1(jIntensity,3) = subplot(3,3,3+3*(jIntensity-1));
88+
thisCol = sum([currTotCols; intCols{jIntensity}; onCols{1}],1)==3;
89+
plot(simTime, simDataMat{iPanel}(:,thisCol),'b');
90+
hold on;
91+
thisCol = sum([currTotCols; intCols{jIntensity}; onCols{2}],1)==3;
92+
plot(simTime, simDataMat{iPanel}(:,thisCol),'m');
93+
94+
elseif strcmp(stType,'freq') % only one current to plot
95+
% plot stimulus traces
96+
axh1(jIntensity,1) = subplot(3,3,1+3*(jIntensity-1));
97+
thisCol = sum([stimCols; intCols{jIntensity}],1)==2;
98+
plot(simTime, simDataMat{iPanel}(:,thisCol),'b');
99+
100+
% plot experimental total current
101+
axh1(jIntensity,2) = subplot(3,3,2+3*(jIntensity-1));
102+
% separate exp traces into aligned on and off for plotting
103+
104+
% plot simulated total current
105+
axh1(jIntensity,3) = subplot(3,3,3+3*(jIntensity-1));
106+
thisCol = sum([currTotCols; intCols{jIntensity}],1)==2;
107+
plot(simTime, simDataMat{iPanel}(:,thisCol),'b');
108+
end
109+
71110
for kDist = 1:length(distTypes)
111+
figure(fh(iPanel,2));
72112
plotNo = kDist+4*(jIntensity-1);
73113
axh(plotNo) = subplot(3,4,plotNo);
114+
if strcmp(stType,'disp') || strcmp(stType,'speed')
115+
%plot on
116+
%plot off
117+
elseif strcmp(stType,'freq')
118+
%plot current
119+
end
120+
74121
end
75122

123+
% set xlim and ylim based on iPanel and jIntensity
124+
76125
end
77126

78127
clear axh;

0 commit comments

Comments
 (0)