what is happening here?

12 ビュー (過去 30 日間)
Salman Yahya
Salman Yahya 2019 年 10 月 22 日
回答済み: Image Analyst 2019 年 10 月 22 日
for j = 1:6 - 1
if sign(i(j,1)) * sign(i(j+1,1)) == -1
m = m + 1;
end
end
in this code what does "1:6-1" means?

採用された回答

Star Strider
Star Strider 2019 年 10 月 22 日
‘in this code what does "1:6-1" means?
It is a kludgy way of writing:
1:5
as running it will demonstrate:
q = 1:6-1
produces:
q =
1 2 3 4 5

その他の回答 (1 件)

Image Analyst
Image Analyst 2019 年 10 月 22 日
Try it in the command window:
>> 1:6-1
ans =
1 2 3 4 5
First it does (6-1) to create a scalar 5, then it goes from 1 to (6-1) or 1 to 5 to give [1,2,3,4,5].

カテゴリ

Help Center および File ExchangeData Types についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by