How to vectorize this for loop with if statement

回答 (1 件)

David Hill
David Hill 2020 年 12 月 7 日

1 投票

P = zeros(100,200)
P(1,:)=10;
P(:,1)=10;
P(2:end,2:end)=M(2:end,2:end)-M(2:end,1:end-1);

カテゴリ

タグ

質問済み:

2020 年 12 月 7 日

編集済み:

2020 年 12 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by