Array slice indexing?

236 ビュー (過去 30 日間)
Nour Salhab
Nour Salhab 2017 年 11 月 13 日
回答済み: Mohammed Hamaidi 2022 年 3 月 22 日
Hey
please explain what the following function does :
y=a(i,end:-1:1);
if you could give me an example that would be great! thank you

回答 (2 件)

the cyclist
the cyclist 2017 年 11 月 13 日
編集済み: the cyclist 2017 年 11 月 13 日
It returns the ith row of a, in right-to-left order.
You might want to study Getting Started with MATLAB.

Mohammed Hamaidi
Mohammed Hamaidi 2022 年 3 月 22 日
Take for example:
a=[1 2 3; 5 6 7; 8 9 12]
and
i=2
then
a(i,end:-1:1)
gives: the 2nd row in right to left order (the elements of the 2nd row from right to left)
ie: 7 6 5

カテゴリ

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