Retrieving data from txt file.
2 次查看(过去 30 天)
显示 更早的评论
%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.
0 个评论
采纳的回答
Azzi Abdelmalek
2014-2-2
编辑:Azzi Abdelmalek
2014-2-2
[FileName1,PathName] = uigetfile('*.xlsx','Select the excel file')
[num,txt1,raw] = xlsread(fullfile(PathName,FileName1))
For a text file you cane use importdata
5 个评论
Azzi Abdelmalek
2014-2-2
fid=fopen('file.txt')
a=textscan(fid,'%s %f %f %f','headerlines',2)
fclose(fid)
text1=a{1}
num=cell2mat(a(2:4))
更多回答(1 个)
mohamad basma
2016-5-11
[FileName1,PathName] = uigetfile('*.xlsx','Select the excel file') [num,txt1,raw] = xlsread(fullfile(PathName,FileName1))
How can i get the data in a matrix from this function?
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!