Is it possible to bin/discretize multidimensional matrices?

4 ビュー (過去 30 日間)
alberto tonizzo
alberto tonizzo 2022 年 5 月 26 日
コメント済み: alberto tonizzo 2022 年 5 月 26 日
I have a 5D matrix that I want to bin according to a vector that has the same length as the first dimension of the matrix.
Thank you!

採用された回答

Walter Roberson
Walter Roberson 2022 年 5 月 26 日
bins = discretize(TheMatrix, Vector_of_Breakpoints);
It does not matter how many entries are in Vector_of_Breakpoints as long as there are at least two values and the vector is sorted.
The result would be a matrix the same size as TheMatrix.
If any values are less than Vector_of_Breakpoints(1) or greater than Vector_Of_Breakpoints(end) then the corresponding output will be 0.
Note that by default the maximum bin number will be length(Vector_of_Breakpoints)-1 with the values exactly equal to Vector_of_Breakpoints(end) being placed together with the previous bin. There are options to change how the boundaries work.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by