|
9 | 9 | simPath = 'C:\Users\Sammy\Dropbox\Goodman Lab\Posters Papers Proposals\2018-Katta-SpatiotemporalDynamics\source-data\sim-channel-distance\'; |
10 | 10 | simFiles = {'channel-distance-displacement.xlsx','channel-distance-speed.xlsx','channel-distance-frequency.xlsx'}; |
11 | 11 | 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,:)); |
15 | 16 | end |
16 | 17 |
|
17 | 18 | recData = cell(0); |
|
28 | 29 | % figure('Position',[200 200 800 600]); |
29 | 30 |
|
30 | 31 | 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 |
33 | 34 |
|
34 | 35 | switch iPanel |
35 | 36 | case 1 % displacement |
|
45 | 46 |
|
46 | 47 | % find all subsets of columns now, use overlap in indices later to pull |
47 | 48 | % 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)); |
53 | 54 |
|
54 | 55 | intTypes = cellfun(@(x) regexp(x,sprintf('_%s(\\S{1,5})',stType),'tokens'),simHeaders,'un',0); |
55 | 56 | intTypes = [intTypes{:}];intTypes = [intTypes{:}]; |
56 | 57 | intTypes = unique(intTypes,'stable'); |
57 | 58 | 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)); |
59 | 60 | end |
60 | 61 |
|
61 | 62 | distTypes = cellfun(@(x) regexp(x,'_dist(\S{1,4})_','tokens'),simHeaders,'un',0); |
62 | 63 | distTypes = [distTypes{:}];distTypes = [distTypes{:}]; |
63 | 64 | distTypes = unique(distTypes,'stable'); |
64 | 65 | 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 |
69 | 70 | for jIntensity = 1:length(intTypes) |
| 71 | + figure(fh(iPanel,1)); |
70 | 72 |
|
| 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 | + |
71 | 110 | for kDist = 1:length(distTypes) |
| 111 | + figure(fh(iPanel,2)); |
72 | 112 | plotNo = kDist+4*(jIntensity-1); |
73 | 113 | 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 | + |
74 | 121 | end |
75 | 122 |
|
| 123 | + % set xlim and ylim based on iPanel and jIntensity |
| 124 | + |
76 | 125 | end |
77 | 126 |
|
78 | 127 | clear axh; |
|
0 commit comments