MATLAB: Retrieving data from txt file.

txtuigetfile

%I retrieve data from excel like that,
[FileName1,PathName] = uigetfile('*.xlsx','Select the excel file')
[num,txt1,raw] = xlsread(FileName1)
%I have a .txt file which I need to extract data from it so I need to apply this way to retrieve data from a .txt file. How can I do that.

Best Answer

[FileName1,PathName] = uigetfile('*.xlsx','Select the excel file')
[num,txt1,raw] = xlsread(fullfile(PathName,FileName1))
For a text file you cane use importdata