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:
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
fileID = fopen(fullfile(pathname, filename)); % Open the file
A = fread(fileID); % Read from the file
fclose(fileID); % Close the file
S = char(A)
disp
won't load data anywhere, let alone in GUI. Whatelse have you tried? – Divakar