export_MUA.m 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. %%% export MUA - THINGS dataset
  2. % 2022 P. Papale fecit
  3. clear all
  4. addpath(genpath('\_code\code_utils_v2\'));
  5. % constants
  6. monkey = 'monkeyF';
  7. datadir_gen = '\';
  8. reliab_th = .3;
  9. arrays_to_export = 1:16;
  10. % arrays_to_export(5) = [];
  11. %
  12. filename = [datadir_gen,monkey,'\THINGS_normMUA.mat'];
  13. load(filename)
  14. % divide all into arrays
  15. idx_array = 0;
  16. for i = 1:1024
  17. idx_chn = mod(i,64);
  18. if idx_chn == 1
  19. idx_array = idx_array+1;
  20. elseif idx_chn == 0
  21. idx_chn = 64;
  22. end
  23. idx_mapping(i,:) = [idx_array,idx_chn];
  24. train_MUA_array(idx_array,idx_chn,:) = train_MUA(i,:);
  25. test_MUA_array(idx_array,idx_chn,:) = test_MUA(i,:);
  26. mean_reliab_array(idx_array,idx_chn) = mean(reliab(i,:));
  27. end
  28. % threshold based on reliability and export
  29. for i = arrays_to_export
  30. clear temp_rel good_chns train_MUA test_MUA filename
  31. temp_rel = mean_reliab_array(i,:) > reliab_th;
  32. good_chns = find(temp_rel);
  33. train_MUA = train_MUA_array(i,temp_rel,:);
  34. test_MUA = test_MUA_array(i,temp_rel,:);
  35. filename = [datadir_gen,monkey,'\THINGS_exportMUA_array',num2str(i),'.mat'];
  36. save(filename,'test_MUA','train_MUA','temp_rel','good_chns','-v7.3')
  37. pause(5)
  38. end