Need up to 30 seconds to load, if not generated.
hello friends in this video I am going
to discuss how to reverse an array in
the MATLAB okay so see how to reverse
suppose let me take one and A one two
three okay all three elements
now suppose these inputs are stored in a
matrix or a vector or whatever you say
now suppose I wanted B array which is
whose elemental be like this 3 3 2 then
1 then what is happening you just try to
understand be your one because in MATLAB
theorem do start from 1 is equal to K of
3 then B of 2 equal to a of 2 women you
do not check symmetrical getting B of 3
equal to a of 1 so see what is happening
here here just we are reversing that
means like this so to make it or like
this what we can do just simple B of
suppose one variable then normally
notice 1/4 mile writing this B of I
equal to a of n minus 1 okay suppose
bf109 so what is the meaning of B of 1
in array of n minus 1 here in because in
sorry
in Java it becomes a of a minus 1 but in
MATLAB it is the event C the first
element of B is the last element of PML
drinks and considered if like what did
happen this index position C is
increasing and this in this region of a
see it is decreasing okay and it will go
out to one so this is the basic
algorithm to reverse in okay so see how
I am writing based on this concept X
equal to en put their entire the array
okay
basically we can say matrix also now for
I equal to length of its minus 1 sorry
length of X colon minus 1 1 1 foil
because once again yes
so what is happening the lien topics it
will start from length of x it will
decrease by 1 value and it will go up to
1 so P let me give some other variable y
equal to X I so what will have been
initially this smaller Y variable value
will be nothing but X of length of X
that is the last element of the input so
we can store it in an array we can
define y equal to 1
empty entries then here y equal to we
can write Y then small voice you know
how to insert any means in any right
from my previous video so see what will
happen suppose in the first hydrogen is
the length of X so suppose there are two
elements in the case let me take here 1
& 2 ok so what will happen length of X
is 2 so I have 1 that means 2 & 1 is
going to be value of Phi this small ray
will be able to in such I initially L
spending either is to say X of 2 so
small - is it so - is so - is what -
right so even our Y variable
- will be store - also now I becomes 1
so small I always become a sub 1 X sub 1
is 1 so now in deriving l1 is going to
be stored she'll be ready and in this
way from 1 2 we will get to 1 that is
the first thing ah any
down let us check or through a selection
enter the array suppose let me give
their input one eight six five four
seven six one okay I have given it and
only
our c4 in solving so huge huge liability
concerns are there in use those given
development okay so this is all for this
video
almost the same code in the description
of this video if you have any doubt you
can ask in the comment section thank you
for watching



















