⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readlab.m

📁 能够简单识别0~9十个数字的matlab程序
💻 M
字号:
function [qs,zz,num]=readlab(file)

fid=fopen(file,'r','b');
if fid < 0
   error(sprintf('Cannot read from file %s',file));
end
F= fread(fid,'uchar');
j=1;
for i=1:4
        b=0;
    while F(j) ~= 32
        aa=F(j);
        j=j+1;
        aa=aa-48;
        b=b*10+aa;
    end
    j=j+1;
    qs(i)=b;
    b=0;
    while F(j) ~= 32
        aa=F(j);
        j=j+1;
        aa=aa-48;
        b=b*10+aa;
    end
    j=j+1;
    zz(i)=b;
    b=0;
    while F(j) ~= 10
        aa=F(j);
        j=j+1;
        b=b+aa;
    end
    num(i)=b;
    j=j+1;
end
for i=1:4
switch num(i)
          case {236}
            num(i)=5;
         case {422}
            num(i)=7;
          case {195}
            num(i)=8;
            case {330}
            num(i)=6;
         case {523}
            num(i)=2;
          case {322}
            num(i)=3;
            case {220}
            num(i)=4;
         case {331}
            num(i)=9;
          case {424}
            num(i)=0;
            case {329}
            num(i)=1;
          otherwise
            num(i)=num(i);
end
        
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -