title: Load data and save data in Matlab GUI
body: <p>Hello I am trying to create a GUI in Matlab. Using a push button I try to select .txt file an load it as a matrix. My only problem is that I can select the .txt file  but I cannot load it in the workspace. Here what I have done till now:</p>
  
  <pre><code>function pushbutton1_Callback(hObject, eventdata, handles)
  [filename, pathname] = uigetfile('*.txt', 'Select a MATLAB code file');
  if isequal(filename,0)
     disp('User selected Cancel')
  else
     disp(['User selected ', fullfile(pathname, filename)])
  end
  </code></pre>
  
  <p>fileID = fopen(fullfile(pathname, filename)); % Open the file</p>
  
  <p>A = fread(fileID); % Read from the file</p>
  
  <p>fclose(fileID); % Close the file</p>
  
  <p>S = char(A)</p>