matlab读取数据并操作

matlab读取数据并操作

M2=[]
fid = fopen('2020-12-27-16-19-52.txt');
tline = fgetl(fid);
k=1;
while ischar(tline)
    %disp(tline)
    
    
    S = regexp(tline, '\s+', 'split');
    %disp(S(2))
    %M2(k)=str2num(cell2mat(S(2)));
    data_cell=S(2);
    %M2(k)=d1;
    %class(data_cell);
    
    data_double=transpose(str2num(cell2mat(data_cell)));
    %M2(M2,k)=data_double;
    
    M2=[M2 data_double];
    
    tline = fgetl(fid);
    
    
    
    
    k=k+1;
end
fclose(fid);

M2

 

posted @ 2021-04-01 19:18  西北逍遥  阅读(888)  评论(0编辑  收藏  举报