How to use discretize
    5 ビュー (過去 30 日間)
  
       古いコメントを表示
    
I am currently trying to use discretize to group data into bins.
I would like to group each column of a multi-dimensional data into a bin as if it is one data.
If I use the documentation method as is, the result is 
>> a = rand(10):
>> [y, e] = discretize(a,3)
y =
     3     1     2     2     2     1     2     3     1     1
     3     3     1     1     1     2     1     1     3     1
     1     3     3     1     2     2     2     3     2     2
     3     2     3     1     2     1     2     1     2     2
     2     3     2     1     1     1     3     3     3     3
     1     1     2     3     2     2     3     1     1     1
     1     2     2     2     2     3     2     1     2     2
     2     3     1     1     2     1     1     1     2     2
     3     2     2     3     2     2     1     2     1     1
     3     3     1     1     2     1     1     2     2     1
e =
         0    0.4000    0.8000    1.2000
.
I want to make it look like 
 y =
     3
     3
     1 
     1 
     2   
     3    
     2     
     1     
     1   
     1         
.
How can I do this?
2 件のコメント
  Steven Lord
    
      
 2021 年 3 月 30 日
				rng default
A = rand(5)
[y, e] = discretize(A, 3)
For this smaller example, what exactly would you want y to look like and how exactly would you compute that exected result? The more specifically you can explain how you would generate your grouping model the easier it will be for us to help you implement it.
  dpb
      
      
 2021 年 3 月 30 日
				"... as if it is one data"
Maybe the idea is
>> [y,e]=discretize(A(:),3)
y =
     3
     3
     1
     3
     2
     1
     1
     2
     3
     3
     1
     3
     3
     2
     3
     1
     2
     3
     2
     3
     2
     1
     3
     3
     2
e =
         0    0.4000    0.8000    1.2000
>> 
?
回答 (0 件)
参考
カテゴリ
				Help Center および File Exchange で Get Started with MATLAB についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


