How do we extract a 2D matrix out of a 2D matrix?

2 ビュー (過去 30 日間)
BBB
BBB 2019 年 11 月 11 日
コメント済み: BBB 2019 年 11 月 12 日
I have a 2D matrix of 600x1000 and I want to create a nested loop to extract 51x51 matrix data. How can we do that? Thanks.

回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 11 月 12 日
for row_index = 1 : number_of_rows_to_transfer
for column_index = 1 : number_of_columns_to_transfer
TheOutputArray(row_index, column_index) = TheInputArray(row_index+row_offset, column_index+column_offset);
end
end
  1 件のコメント
BBB
BBB 2019 年 11 月 12 日
Hi Walter,
Is this right?
for hh = 1:10000
for pp = 1:600
u(hh,pp)= im(1:51,1:51);
end
end

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

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by