关于python:Matlab数据可视化

36次阅读

共计 2352 个字符,预计需要花费 6 分钟才能阅读完成。

%% 导入数据
load tran_data.mat
class=avilatr(:,end); % 这个办法读取进去是 table
class1=avilatr{:,end}; % 这个读取进去是字符串,能够用 find 操作
%% A 类索引
class_A=find(class1==”A”)’;
A=avilatr{class_A,1:10};
%% 每一列属性
A1=A(:,1);A2=A(:,2);A3=A(:,3);A4=A(:,4);A5=A(:,5);A6=A(:,6);A7=A(:,7);A8=A(:,8);A9=A(:,9);A10=A(:,10);
%% B 类索引
class_B=find(class1==”B”)’;
B=avilatr{class_B,1:10};
%% 每一列属性
B1=B(:,1);PerfectMoney 下载 B2=B(:,2);B3=B(:,3);B4=B(:,4);B5=B(:,5);B6=B(:,6);B7=B(:,7);B8=B(:,8);B9=B(:,9);B10=B(:,10);
%% C 类索引
class_C=find(class1==”C”)’;
C=avilatr{class_C,1:10};
%% 每一列属性
C1=C(:,1);C2=C(:,2);C3=C(:,3);C4=C(:,4);C5=C(:,5);C6=C(:,6);C7=C(:,7);C8=C(:,8);C9=C(:,9);C10=C(:,10);
%% histogram 1
figure(1)
suptitle(‘Histogram 1’)
subplot(3,3,1);
histogram(A1,20);title(‘Attribute1 of A’)
subplot(3,3,2);
histogram(A2,20);title(‘Attribute2 of A’);
subplot(3,3,3);
histogram(A3,20);title(‘Attribute3 of A’)
subplot(3,3,4);
histogram(B1,20);title(‘Attribute1 of B’)
subplot(3,3,5);
histogram(B2,20);title(‘Attribute2 of B’)
subplot(3,3,6);
histogram(B3,20);title(‘Attribute3 of B’)
subplot(3,3,7);
histogram(C1,20);title(‘Attribute1 of C’)
subplot(3,3,8);
histogram(C2,20);title(‘Attribute2 of C’)
subplot(3,3,9);
histogram(C3,20);title(‘Attribute3 of C’)
%% Histogram 2
figure(2)
suptitle(‘Histogram 2’)
subplot(3,3,1)
histogram(A4,20);title(‘Attribute4 of A’)
subplot(3,3,2)
histogram(A5,20);title(‘Attribute5 of A’)
subplot(3,3,3)
histogram(A6,20);title(‘Attribute6 of A’)
subplot(3,3,4)
histogram(B4,20);title(‘Attribute4 of B’)
subplot(3,3,5)
histogram(B5,20);title(‘Attribute5 of B’)
subplot(3,3,6)
histogram(B6,20);title(‘Attribute6 of B’)
subplot(3,3,7)
histogram(C4,20);title(‘Attribute4 of C’)
subplot(3,3,8)
histogram(C5,20);title(‘Attribute5 of C’)
subplot(3,3,9)
histogram(C6,20);title(‘Attribute6 of C’)
%% Histogram 3
figure(3)
suptitle(‘Histogram 3’)
subplot(3,4,1)
histogram(A7,20);title(‘Attribute7 of A’)
subplot(3,4,2)
histogram(A8,20);title(‘Attribute8 of A’)
subplot(3,4,3)
histogram(A9,20);title(‘Attribute9 of A’)
subplot(3,4,4)
histogram(A10,20);title(‘Attribute10 of A’)
subplot(3,4,5)
histogram(B7,20);title(‘Attribute7 of B’)
subplot(3,4,6)
histogram(B8,20);title(‘Attribute8 of B’)
subplot(3,4,7)
histogram(B9,20);title(‘Attribute9 of B’)
subplot(3,4,8)
histogram(B10,20);title(‘Attribute10 of B’)
subplot(3,4,9)
histogram(C7,20);title(‘Attribute7 of C’)
subplot(3,4,10)
histogram(C8,20);title(‘Attribute8 of C’)
subplot(3,4,11)
histogram(C9,20);title(‘Attribute9 of C’)
subplot(3,4,12)
histogram(C10,20);title(‘Attribute10 of C’)

正文完
 0