command for extracting data??

can someone explain this command x1a = x1(1:end-tau-dt); i'm really confuse with this line in my function where tau = 1 dt = 1 but what is meaning of "end" here please some one explain me.

回答 (2 件)

madhan ravi
madhan ravi 2018 年 11 月 2 日
編集済み: madhan ravi 2018 年 11 月 2 日

0 投票

simple example see indexing for better understanding
>> x1 = 1:10
tau =1
dt = 1
a = x1(1:end-tau-dt)
x1 =
1 2 3 4 5 6 7 8 9 10
tau =
1
dt =
1
a =
1 2 3 4 5 6 7 8
>>

1 件のコメント

madhan ravi
madhan ravi 2018 年 11 月 2 日
end represent the last index of an array so 10-1-1 ==>8 so elements from 1 to 8 are extracted from the vector x1 it also simply represents
x1(1:8)

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

Bruno Luong
Bruno Luong 2018 年 11 月 2 日

0 投票

'end' when used in array indexing is replaced by size(x1,n), where n is the dimension where the 'end' appears.
Here in your case it is x1(1:size(x1,2)-tau-dt), so it is indexed from 1 to ( tau+dt) before the last element.

カテゴリ

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

質問済み:

2018 年 11 月 2 日

回答済み:

2018 年 11 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by