Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

getFile.m.svn-base 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. function [dataFilename dataFolder] = getFile(filterSpec, title)
  2. % getFile
  3. %
  4. % Similar to uigetfile, it opens a dialogue to get a file, but it also
  5. % remembers the last folder location, so the user will not need to navigate
  6. % to the same folder multiple times.
  7. %
  8. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. % Use [dataFilename dataFolder] = getFile(filterSpec)
  10. %
  11. % filterSpec: The type of file to show. For example, if set to '*.txt'
  12. % (OPTIONAL) only text files will be visible for choosing.
  13. % DEFAULT: *.*, so all files are shown.
  14. %
  15. % title: This parameter will be the title of the dialogue box.
  16. % (OPTIONAL) DEFAULT: No title will be shown.
  17. %
  18. % dataFilename: The name of the chosen file.
  19. %
  20. % dataFolder: The path of the chosen file.
  21. %
  22. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  23. % USAGE EXAMPLE:
  24. %
  25. % [fileName pathName] = getFile('*.jpg');
  26. %
  27. % In this example a dialogue will open and only show all jpg files. The
  28. % name of the chosen file and the path to it are stores in fileName and
  29. % pathName respectively.
  30. %
  31. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  32. % Kian Torab
  33. % ktorab@blackrockmicro.com
  34. % Blackrock Microsystems
  35. % Salt Lake City, UT
  36. % Contributors:
  37. %
  38. % Version 1.0.0.0 - October 29, 2010
  39. % Last edit by: Kian Torab
  40. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  41. if ~exist('filterSpec', 'var')
  42. filterSpec = '*.*';
  43. end
  44. if ~exist('title', 'var')
  45. title = '';
  46. end
  47. settingFileFullPath = getSettingFileFullPath('getFile');
  48. %% Opens the getFolder.ini file to see what the last accessed folder was
  49. if exist(settingFileFullPath, 'file') == 2
  50. settingsFID = fopen(settingFileFullPath, 'r');
  51. defaultOpenLocation = fscanf(settingsFID, '%200c');
  52. fclose(settingsFID);
  53. [dataFilename dataFolder] = uigetfile([defaultOpenLocation filterSpec], title);
  54. else
  55. [dataFilename dataFolder] = uigetfile(filterSpec, title);
  56. end
  57. %% Saves the last opened folder in the getFolder.ini file for later use
  58. if ischar(dataFolder)
  59. settingsFID = fopen(settingFileFullPath, 'w');
  60. fprintf(settingsFID, '%s', dataFolder);
  61. fclose(settingsFID);
  62. end