MATLAB Answers

0

How to manipulate this matrix?

Latest activity Commented on by madhan ravi
on 1 Nov 2018
if true
% code
A= [0,0,0;0,2,3;1,2,3]
ExpectedA=[3,2,1;3,2,0;0,0,0]

  0 Comments

Sign in to comment.

1 Answer

Answer by madhan ravi
on 1 Nov 2018
Edited by madhan ravi
on 1 Nov 2018
 Accepted Answer

A= [0,0,0;0,2,3;1,2,3]
Expected_A=[3,2,1;3,2,0;0,0,0]
result=fliplr(flip(A,1)) %here is the manipulation
logical(Expected_A==result) %to check expected result is the same as the manipulated
command window:
>> COMMUNITY
A =
0 0 0
0 2 3
1 2 3
Expected_A =
3 2 1
3 2 0
0 0 0
result =
3 2 1
3 2 0
0 0 0
ans =
3×3 logical array
1 1 1
1 1 1
1 1 1
>>

  4 Comments

Show 1 older comment
madhan ravi
on 1 Nov 2018
[m,n]=size(result)
result = [nan(m,1) result]
Actually these are the values which i want to flip but the Nan should not move from its place
madhan ravi
on 1 Nov 2018
get back to your old question

Sign in to comment.