フィルターのクリア

How can I find the minimum value from all the cells in a cell array?

13 ビュー (過去 30 日間)
Raúl Alonso Merino
Raúl Alonso Merino 2019 年 3 月 18 日
コメント済み: Mehri Mehrnia 2022 年 6 月 27 日
Hello, I have a cell array of 1x1296 in which each cell has 32 values. I would like to know how to find the minimum of all the cells, having the 32 values of 1 cell summed. Let's say I have one cell with: [1 0 1 0 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 1 0 0 0 1 0 1 0 1 0 1 1] that sums 19 in total and another cell similar to this one that sums 17, I would like to know how to do that for all the 1296 cells and then extract the minimum value of all of them.
Edit: The minimun in absolute value, I mean, between -0.3 and 0.1, 0.1 is the minimum value I wanted.
Edit 2: each cell is a vector 1x1x32 so I would like to sum all the 32 values into 1 and then finding the minimum absolute value of all 1296 cells.
Cell.png
Thank you!

採用された回答

madhan ravi
madhan ravi 2019 年 3 月 18 日
[Value,Which_cell]=min(cellfun(@sum,C))
% or
[Value,Which_cell]=min(sum(cat(1,C{:}),2)) % assuming all cells have same size of elements
  5 件のコメント
madhan ravi
madhan ravi 2019 年 3 月 18 日
Next time illustrate the issue clearly to avoid confusions like this.
Mehri Mehrnia
Mehri Mehrnia 2022 年 6 月 27 日
what is the solution if cell arrays are in different sizes?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by