|
|
fid = fopen('新建文本文档.txt');
6 C; K: C7 J( z0 l/ P4 P) W7 Pdata =textscan(fid,'%s %s %s');3 r( Z$ T' ]3 H2 g$ A6 a6 l! m3 w# s# t
a = data(1,[1,2]);4 z# P. q( h ^7 F- _; o
aa = cell2mat(cellfun(@(x) str2num(char(x)),a,'UniformOutput',false));
/ d5 F! a; W0 @/ x5 r& P% ab = data{:,3};
( z, ]5 ? F2 n1 |c = cellfun(@(x) str2num(char(x)),b,'UniformOutput',false);
& T3 i b/ D- `$ v7 z% Nindex=cell2mat(cellfun(@(x) ~isempty(x),c,'UniformOutput',false));
$ S0 H% m* a0 v8 V* E7 }- c' rresult = [aa(index,: ), vertcat(c{index})];, ~$ g' _8 h* t% W9 i
fclose(fid); |
|