retrieve single element in cell array

4 ビュー (過去 30 日間)
yasmin
yasmin 2016 年 8 月 17 日
編集済み: Stephen23 2016 年 8 月 17 日
Hi
I have the 1x100 cell that consists of 16x16 double array data for each cell. I want to retrieve a single element let sat at row 2, column 1 for each array data in each cell and put the retrieve data from all 100 cell as another array data. How can I do this?
attached is my cell data.
  1 件のコメント
yasmin
yasmin 2016 年 8 月 17 日
sat is say.sorry for typing error.

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

回答 (2 件)

KSSV
KSSV 2016 年 8 月 17 日
N = length(array) ;
iwant = zeros(N,1) ;
for i = 1:N
iwant(i) = array{i}(2,1) ;
end
  1 件のコメント
yasmin
yasmin 2016 年 8 月 17 日
TQ. it works successfully!!!

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


Stephen23
Stephen23 2016 年 8 月 17 日
編集済み: Stephen23 2016 年 8 月 17 日
In just one line, where array is your cell array:
out = cellfun(@(m)m(2,1),array)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by