ck_GetAtlasTable.m 818 B

1234567891011121314151617181920212223242526272829
  1. function atlas_table = ck_GetAtlasTable(file)
  2. %% Setup the Import Options and import the data
  3. opts = delimitedTextImportOptions("NumVariables", 3);
  4. % Specify range and delimiter
  5. opts.DataLines = [1, Inf];
  6. opts.Delimiter = " ";
  7. % Specify column names and types
  8. opts.VariableNames = ["Code", "Name", "Altname"];
  9. opts.VariableTypes = ["double", "string", "string"];
  10. % Specify file level properties
  11. opts.ExtraColumnsRule = "ignore";
  12. opts.EmptyLineRule = "read";
  13. opts.ConsecutiveDelimitersRule = "join";
  14. opts.LeadingDelimitersRule = "ignore";
  15. % Specify variable properties
  16. opts = setvaropts(opts, ["Name", "Altname"], "WhitespaceRule", "preserve");
  17. opts = setvaropts(opts, ["Name", "Altname"], "EmptyFieldRule", "auto");
  18. % Import the data
  19. atlas_table = readtable(file, opts);
  20. %% Clear temporary variables
  21. clear opts