importColors_bb.m 621 B

12345678910111213141516171819202122
  1. function colorStruct = importColors_bb()
  2. % Colors from Wong B. Nat Methods 8;6, 441 (2011).
  3. workbookFile = fullfile(ottBari2020_root, 'MatlabScripts', 'HelperFunctions', 'colors.xlsx');
  4. % Import the data
  5. [~, ~, raw] = xlsread(workbookFile);
  6. raw = raw(2:end, :);
  7. charVectors = string(raw(:,[1, 2]));
  8. charVectors(ismissing(charVectors)) = '';
  9. charVectors = cellstr(charVectors);
  10. for i = 1:size(charVectors, 1)
  11. % charVectors{i, 2} = str2double(charVectors{i, 2});
  12. color = str2num(charVectors{i, 2})./255;
  13. colorName = charVectors{i, 1};
  14. colorStruct.(colorName) = color;
  15. end