Array slice indexing?

385 visualizzazioni (ultimi 30 giorni)
Nour Salhab il 13 Nov 2017
Risposto: Mohammed Hamaidi il 22 Mar 2022
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
0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Risposte (2)

the cyclist il 13 Nov 2017
Modificato: the cyclist il 13 Nov 2017
It returns the ith row of a, in right-to-left order.
You might want to study Getting Started with MATLAB.
0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Mohammed Hamaidi il 22 Mar 2022
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
0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Categorie

Scopri di più su Matrix Indexing in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by