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 Exchange에서 Matrix 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