1
如何在其他列中生成n個樣本和帶有數字的標籤。生成n個樣本並將它們標記爲Matlab
我有這樣的:
n= 5;
sample1= randn(n,1)
sample2= randn(n,1)
sample1 =
0.3481
0.2328
0.6735
-0.1274
-0.4146
sample2 =
-1.4964
-0.7325
-1.0193
-0.6829
-0.4427
我想
sample1 =
0.3481 -1
0.2328 -1
0.6735 -1
-0.1274 -1
-0.4146 -1
sample2 =
-1.4964 1
-0.7325 1
-1.0193 1
-0.6829 1
-0.4427 1
而在一個矩陣擁有所有數據:
data=
0.3481 -1
0.2328 -1
0.6735 -1
-0.1274 -1
-0.4146 -1
-1.4964 1
-0.7325 1
-1.0193 1
-0.6829 1
-0.4427 1
How to do this?