|
|
fid = fopen('新建文本文档.txt');
9 G1 Q- v! w0 P4 U0 ^; i ^8 t0 }data =textscan(fid,'%s %s %s');5 D$ A; G6 O8 U% @0 u! g
a = data(1,[1,2]);. [5 S1 W" g2 g. R" l9 C$ u
aa = cell2mat(cellfun(@(x) str2num(char(x)),a,'UniformOutput',false));% f) a1 d% s$ ^# F% C
b = data{:,3};
7 u1 U( L1 v1 M/ a$ \( i5 M+ g* f" Oc = cellfun(@(x) str2num(char(x)),b,'UniformOutput',false);, k" |( f2 W5 p9 {1 C0 r% o
index=cell2mat(cellfun(@(x) ~isempty(x),c,'UniformOutput',false));
; v% @7 W* p0 C( a5 D( X$ @result = [aa(index,: ), vertcat(c{index})];; d4 I5 l5 }1 G% X7 p# f9 Q! G# L
fclose(fid); |
|