串口调试

最近调试串口发现matlab突然不会用了,于是决定记录一下解决方法

fidin=fopen('file1.txt');%比较复杂的,每行的列数不一致的,特殊字符
a=textscan(fidin,'%s');
f(:,1)=a{1}(14:17:end,1);f(:,2)=a{1}(15:17:end,1);
fclose(fidin);
g=cellstr(cell2mat(f));%合并两列 alpha=hex2dec(g); fidout=fopen('dian.txt','w'); fidout2=fopen('dianya.csv','w'); for i=1:length(alpha) fprintf(fidout,'%.4f\r\n',alpha(i)*0.01); fprintf(fidout2,'%.4f\r\n',alpha(i)*0.01);%按列输出,若要按行输出:fprintf(fid,'%.4\t',A(jj)); end fclose(fidout); [x y]=size(alpha); b=(1:1:x)/10; xlswrite('out.xlsx',b','Sheet1','A1'); xlswrite('out.xlsx',alpha*0.01,'Sheet1','B1'); % d=a{1}(14:17:end,1); % e=a{1}(15:17:end,1); % fprintf(fidout,'%s\n\n',alpha);

  

上一篇:netapp存储设备更换硬盘


下一篇:(4)fprintf和printf区别