selecting a specific range in a matrix and cell array

9 ビュー (過去 30 日間)
AA
AA 2014 年 12 月 23 日
回答済み: Image Analyst 2014 年 12 月 23 日
I have a large cell array with many matrices. I want to select row 1 and column 16 which has a matrix table. in that matrix table i want to select row 861. How do I do that?
a{1,16:861}

採用された回答

Image Analyst
Image Analyst 2014 年 12 月 23 日
% Extract the matrix inside that cell in row 1, column 16
% of the cell array into a regular numerical array.
cellContents = ca{1,16}; % This is a regular normal matrix now
% Now extract row 816 from that matrix:
row861 = cellContents(861, :); % Get all columns of row 861 into row vector.

その他の回答 (1 件)

Sean de Wolski
Sean de Wolski 2014 年 12 月 23 日
Just use two lines of code. There's no shame in doing this. And since MATLAB passes implicitly by reference anyway, it won't require a memory copy unless you change something.
  2 件のコメント
AA
AA 2014 年 12 月 23 日
how do i do that?
Sean de Wolski
Sean de Wolski 2014 年 12 月 23 日
Start here:
You can index into the cell array to extract its contents with {} or to extract the cell as ().

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

カテゴリ

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