简单的MATLAB代码

 交谈中请勿轻信汇款、中奖信息,勿轻易拨打陌生电话。
 
!!??  16:01:53
function mtdata=txttomt(filename,num)
%TXTTOMT 文本转矩阵

for i=1:num
mtdata(1,i)=i;
end

fid=fopen(filename,'rt');
if fid == -1 
('Error opening the file') 
end 
k=1;
while 1
    k=k+1;
    nextline=fgetl(fid);
        
    if ~isstr(nextline)
        break;%读到最后跳出
    end   
    
 %   disp(nextline)
    temp=sscanf(nextline,'%d');
    [c,r]=size(temp);
    for j=1:(c-1)
        mtdata(k,temp(j,1))=temp(c,1);    
原文地址:https://www.cnblogs.com/windphoenix/p/1660498.html