フィルターのクリア

Accessing the deeper components of a cell array

2 ビュー (過去 30 日間)
Peter Ryan
Peter Ryan 2016 年 10 月 20 日
コメント済み: Peter Ryan 2016 年 10 月 20 日
Supposing I have an Nx1 cell array, in which each cell contains a 3x1 vector - how do I extract the third component of each vector in the cell array?
i.e. I need something like: cellarray{:,1}(3,1)
which doesn't work.
I realize this is basic but I've been messing around for a while and couldn't come up with a solution

採用された回答

Guillaume
Guillaume 2016 年 10 月 20 日
You don't have a choice but use a loop or cellfun (which is a loop in effect):
cellfun(@(v) v(3), yourcellarray)
will return a vector of the 3rd element of each cell.

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by