I have Matrix for example
M = ones(10,10)
how I make ( if condition) s.t
M(i-tau,j)=0 if i-tau <0,
where i =1:10 and j =1:10
Thanks

1 件のコメント

Torsten
Torsten 2021 年 5 月 31 日
M(i-tau,j) does not exist if (i-tau)<0. So you can't set it to a specified value ( 0 in this case ).

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

 採用された回答

Steven Lord
Steven Lord 2021 年 5 月 31 日

0 投票

M(i-tau,j)=0 if i-tau <0,
There's no such thing as row -1 of a matrix in MATLAB. Depending on what you're trying to do you could limit the values of i over which you iterate to those that make i-tau a positive integer value or you could detect the condition where i-tau is negative (actually you'd want to detect when it's non-positive since there's no such thing as row 0 in a matrix in MATLAB either. The first row in a matrix in MATLAB is row 1.) and skip attempting to index into M entirely.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

タグ

質問済み:

2021 年 5 月 31 日

回答済み:

2021 年 5 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by