Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to flip a matrix in Octave

📅 2014-May-12 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ flip, matrix, octave ⬩ 📚 Archive

To flip a matrix about the horizontal axis (up to down), call the flipud function.

To flip a matrix about the vertical axis (left to right), call the fliplr function.

> A = [ 1 2 3; 4 5 6];
> A
A =
   1   2   3
   4   5   6
> flipud(A)
   4   5   6
   1   2   3

These functions are from Matlab and so work in it too.

Tried with: Octave 3.8.1 and Ubuntu 14.04


© 2023 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 Mastodon📧 Email