Rotate matrix A 180 degrees.


  1. Rotate a matrix 180 degrees:

    julia> A = [1 2 3; 4 5 6; 7 8 9];
    julia> rot180(A)
    3×3 Array{Int64,2}:
    9  8  7
    6  5  4
    3  2  1

    This example rotates the matrix A 180 degrees.

  2. Rotate a matrix multiple times:

    julia> B = [10 20; 30 40];
    julia> rot180(B, 3)
    2×2 Array{Int64,2}:
    40  30
    20  10

    It rotates the matrix B 180 degrees three times.

  3. Rotate a matrix of strings:
    julia> C = ["apple" "banana"; "orange" "grape"];
    julia> rot180(C)
    2×2 Array{String,2}:
    "grape"   "orange"
    "banana"  "apple"

    It rotates the matrix of strings C 180 degrees.

Common mistake example:

julia> D = [1 2 3; 4 5 6];
julia> rot180(D, -2)
ERROR: DomainError: Invalid rotation count: -2

In this example, a negative rotation count is provided, resulting in a DomainError. The k argument must be a non-negative integer. Always ensure that the rotation count is valid when using rot180.

See Also

Ac_ldiv_B, Ac_ldiv_Bc, Ac_mul_B, Ac_mul_Bc, Ac_rdiv_B, Ac_rdiv_Bc, At_ldiv_B, At_ldiv_Bt, At_mul_B, At_mul_Bt, At_rdiv_B, At_rdiv_Bt, A_ldiv_Bc, A_ldiv_Bt, A_mul_B!, A_mul_Bc, A_mul_Bt, A_rdiv_Bc, A_rdiv_Bt, Bidiagonal, cond, conv2, det, diag, diagind, diagm, diff, eig, eigvals, eigvecs, expm, eye, full, inv, isdiag, ishermitian, isposdef, isposdef!, issym, istril, istriu, logabsdet, logdet, lyap, norm, qrfact, rank, repmat, rot180, rotl90, rotr90, sortrows, sqrtm, SymTridiagonal, trace, Tridiagonal, tril, tril!, triu, triu!, writedlm,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field

Checking you are not a robot: