フィルターのクリア

Creating a new cell array which is a subset of another cell array

4 ビュー (過去 30 日間)
Adnan Habib
Adnan Habib 2022 年 12 月 28 日
コメント済み: Adnan Habib 2022 年 12 月 28 日
I have a 490X1 cell array (let's call it Output) in which each cell is a 300X300 double. I also have a vector C with dimensions 1X160 which contains row numbers. I want to create another 490X1 cell array where each cell will be a 160X160 double and the selected 160 rows and columns are taken from the row numbers provided in vector C. I know that it can be done through a loop with some logical conditions, but I don't know how to design the codes. Can someone help me out?

採用された回答

Stephen23
Stephen23 2022 年 12 月 28 日
D = Output; % preallocate
for k = 1:numel(D)
D{k} = Output{k}(C,:);
end
  1 件のコメント
Adnan Habib
Adnan Habib 2022 年 12 月 28 日
Thanks a lot Stephen. This worked perfectly!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by