Created
March 23, 2016 21:51
-
-
Save weinberz/708d32cbda9b4b932731 to your computer and use it in GitHub Desktop.
Code for manipulating stuff to shuffle prism data tables for EKAR in and out of MATLAB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % Use databinner function on all variables in workspace. | |
| for i=1:numel(vars) | |
| eval(['[' vars{i} '_avg_2, ' vars{i} '_max_2] = dataBinner(' vars{i} ',2);']) | |
| eval(['[' vars{i} '_avg_5, ' vars{i} '_max_5] = dataBinner(' vars{i} ',5);']) | |
| eval(['[' vars{i} '_avg_10, ' vars{i} '_max_10] = dataBinner(' vars{i} ',10);']) | |
| end | |
| % Generate tables for allowing export of data back to prism. This pads tables | |
| % for use with 30-wide columns in Prism. | |
| for i=[2 5 10] | |
| eval(['vars = who(''-regexp'',''avg_' num2str(i) ''');']); | |
| for j=1:numel(vars) | |
| eval([vars{j} ' = padarray(' vars{j} ', [0 (30 - size(' vars{j} ',2))], NaN, ''post'');']) | |
| end | |
| t = (1:i:60)'; | |
| eval(['avg_table_' num2str(i) ' = table(t, ' strjoin(vars',',') ')']) | |
| end | |
| % This actually writes the above tables to be imported into prism | |
| vars = who('-regexp','_table_'); | |
| for i=1:numel(vars) | |
| eval(['writetable(' vars{i} ')']) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment