How to group the data in an array into similar numbers?

3 ビュー (過去 30 日間)
Anna Mielcarek
Anna Mielcarek 2021 年 10 月 31 日
編集済み: Jan 2021 年 10 月 31 日
I am trying to group the conents of the array (prob_descend) into numbers which are similar (for example 0.4 and 0.3 into one array) and the rest into another array.
Any ideas on how i could sort the values into similar groups?
%Fano method
clear
symbols = (1:6); %demonstrates the symbols
prob = [.4 .3 .1 .03 0.11 0.06]; %probabilites relating to symbols
prob_descend = sort(prob, 'descend');%sorts probabilites
[m,n] = size(prob_descend)
fano_array = mat2cell(prob_descend, [1], [n/6 n/6 n/6 n/6 n/6 n/6])% seperates the array with probabilites into seprate cells
for i = 1:n
%calculates
array_new = n/2;
fano_arr = mat2cell(prob_descend, [1], [array_new array_new]);
[r,c] = size(fano_arr(1,2));
end
  1 件のコメント
Jan
Jan 2021 年 10 月 31 日
編集済み: Jan 2021 年 10 月 31 日
Why are 0.3 and 0.4 "similar"? What is the relation between your question and the shown code?

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by