what does idx mean in matlab

111 ビュー (過去 30 日間)
Prabha Kumaresan
Prabha Kumaresan 2017 年 11 月 27 日
編集済み: Stephen23 2018 年 10 月 31 日
could anybody tell me what does idx mean

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 11 月 27 日
"idx" is nothing special. It is just a variable name, used for whatever the program needs.
Typically it would be used for some kind of index, but "index" in signal processing could refer to modulation index
  2 件のコメント
Glen Hamilton
Glen Hamilton 2018 年 10 月 31 日
編集済み: Glen Hamilton 2018 年 10 月 31 日
For Loops
Initialize x
x = (11:15).^2;
Display the elements of x.
for idx = 1:5
disp(x(idx))
end
if idx is nothing why does MATLAB OnRamp use it like this? idx was never defined as an independent variable yet it seems to be understood as the index for the array
Stephen23
Stephen23 2018 年 10 月 31 日
編集済み: Stephen23 2018 年 10 月 31 日
"if idx is nothing, explain that"
Where was it written that "idx is nothing"?
Walter Roberson correctly wrote that '"idx" is nothing special. It is just a variable name, used for whatever the program needs.' And that is exactly what your code shows: a variable named idx.
The easiest way to learn how MATLAB works is to do the introductory tutorials (which avoids a lot of confusion that some beginners have about very basic concepts, like what variables are and how for loops are defined):
"idx was never defined as an independent variable yet it seems to be understood as the index for the array"
Actually idx was defined as the iterator variable in that for loop:
for idx = 1:5
^^^ it is defined here!

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

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by