Matlab basics-combine the array into a decimal number after passing the threshold, and then draw

The purpose is to give a two-dimensional array (8 columns for 1 row), pass the threshold, convert it into a 0 1 array, and then convert it to a decimal system and draw a picture

function [ ] = draw_differnt_yuzhi2( num,yuzhi,dir,n)
%画出不同阈值下的散点图
%   num为原始表格数据, yuzhi为给定过滤的阈值
%   dir为二进制2十六进制大小端
% quan_x,quan_y分别为x轴圈数,以及y轴合成数据个数
% n为第n幅图像
%绘图完成 下面单独转换数据
subplot(n);
hold on

[x,y]=size(num);
z = [0,4,8,12,16,20];
for i =1:x %42行 8列
    a = filter_yuzhi(num(i,:),yuzhi);
    b(i) = bit2hex(a,dir);
    plot(z(i),b(i),'s:b') %画图
end

set(gca,'xtick',[0,4,8,12,16,20]);%x坐标数值
set(gca,'ytick',[0:30:255]);
xlabel('圈数');
ylabel('十六进制数值');
str = sprintf('当前阈值为 %2f',yuzhi);
title(str);
grid on
hold off
end

 

 

 

 

Guess you like

Origin blog.csdn.net/jwdeng1995/article/details/108931130