how do I flip ever column in a matrix without using the fliplr function?
18 views (last 30 days)
Show older comments
n = randi([4,15]);
n_mat = randi ( [1,100], n, n)
this generates a matrix, and I want basically do the "fliplr" command with just operations
0 Comments
Accepted Answer
Voss
on 18 May 2022
n = randi([4,15]);
n_mat = randi ( [1,100], n, n)
n_mat_flipped = n_mat(:,end:-1:1)
3 Comments
Image Analyst
on 18 May 2022
No. Colon : means "All rows" rather than an entire row. So it's reversing each and every row, putting the last column first, then the next to the last column, and finally on the right edge it will be the original first element in the row. Again that's done for all rows so all columns are flipped left to right..
More Answers (0)
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!