找回密码
 注册
关于网站域名变更的通知
查看: 780|回复: 2
打印 上一主题 下一主题

MATLAB的fliplr 函数介绍,这个函数可以实现从左到右翻转阵列

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2020-1-8 10:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

您需要 登录 才可以下载或查看,没有帐号?注册

x
8 _# c* U; M! f% b4 Q
fliplr6 t5 c, T) s- r0 Q
Flip array left to right
5 e9 \+ ?' [2 m0 J0 a: {, x2 |9 C
! o' E* w# _) _# b# X$ M0 e. F7 j
Syntax' A& p9 u5 l9 _9 J! t/ V( h' K  L
- ]$ J+ R; T$ U) y* I/ b
B = fliplr(A)9 L) f- F' \5 C8 Z; M

: c' h" G2 G8 F! I: I3 R% _# W4 M( L8 M+ W% B# V7 c+ X0 O) s
Description
0 R3 |+ T' F( e* h/ J6 y9 n0 p
7 ~6 U+ q6 H6 c8 t! x* u7 P
B = fliplr(A) returns A with its columns flipped in the left-right direction (that is, about a vertical axis).3 Z# Z# e# u% I: W- X3 T$ R7 b3 v

" T; p: S* M* I& s% X7 \B = fliplr (a) 返回 A, 其列在左右方向 (即关于垂直轴) 反转。, \4 \9 N' h4 \" v+ H7 A
. }. U4 |; p9 B! h" Q6 c
If A is a row vector, then fliplr(A) returns a vector of the same length with the order of its elements reversed. If A is a column vector, then fliplr(A)simply returns A. For multidimensional arrays, fliplr operates on the planes formed by the first and second dimensions./ a/ W+ s% V* ]
9 i# i! }! O7 B4 D7 V6 ~8 R
如果 a 是行向量, 则 fliplr (a) 返回与其元素的顺序反转的相同长度的向量。如果 a 是列向量, 则 fliplr (a) 只是返回 a。对于多维数组, fliplr 在由第一个和第二个维度形成的平面上运行。
) L2 R% t# p/ u: B: [3 k& I3 v1 b
9 _4 n9 r6 _4 j  H2 ^  [
Flip Row Vector
: H& ]0 K3 d- f2 o+ K8 y- r( s
$ m/ V% c% o9 [5 x$ Q  D. oCreate a row vector.
: o1 ]% [7 N3 G: h" B
# ^+ x$ s0 o4 X$ M% {A = 1:104 }+ Z/ w; P1 n6 n( G! f% g$ }
# f( n$ J0 V' p# K( ~0 @
A = 1×10
  K: i0 U3 ?; N7 Q, o* O% Z; Z5 [* n6 Z# P7 h
     1     2     3     4     5     6     7     8     9    10
- Y9 o9 N+ ], e) P; i% o4 }. i+ A5 X5 S  F7 S# _4 j6 _3 b6 X- V6 x
Use fliplr to flip the elements of A in the horizontal direction.' ~/ a! w7 ?8 ]/ w; g# P7 x; @
, ^; q+ l0 x( P0 z% @+ M; D7 L- Y1 p8 M
B = fliplr(A)! [) M/ Q$ A" t! f

: B0 E; \8 x0 p# ^B = 1×106 o+ B  v( i, d9 C

% _3 f( u3 X( M    10     9     8     7     6     5     4     3     2     1. O! Z/ Z& W# h: }' i9 H
% C% R1 q* p* `; Y
The order of the elements in B is reversed compared to A.- l3 z, r: O) h  v

6 {( W+ W1 d. y( c5 P1 }0 I
0 H! z2 f) j/ d& N7 W6 k9 VFlip Cell Array of Characters
) H; }; s2 e1 z" f
& ]+ {% o  S' ~6 P$ m- X7 B9 Q+ q
; J5 x+ m0 N8 i9 B* r/ g' ZCreate a 3-by-3 cell array of characters.0 J) b) N  o! L1 C- D- h

' n8 a# Z7 y6 S5 M4 V5 [A = {'a' 'b' 'c'; 'd' 'e' 'f'; 'g' 'h' 'i'}& ?& U( @: G, W/ }) o, m
% J) [7 o- @1 i) @
A = 3x3 cell array
4 W! T. H4 c8 s/ m2 b5 C' b    {'a'}    {'b'}    {'c'}( _) H: E0 a4 o0 M
    {'d'}    {'e'}    {'f'}$ }7 L' Q0 U8 P  r( y) N; b0 L
    {'g'}    {'h'}    {'i'}
0 _  Z3 |6 y3 U/ U0 {5 d
: O. h; P8 p* [8 m+ \' ~Change the order of the columns in the horizontal direction by using fliplr./ K6 n% C; g7 e! G# `% @
; [3 A  y" p  \9 ?
B = fliplr(A)2 g$ w& J3 d0 y6 G2 H1 y
. k' a6 Y2 k  d, J  L
B = 3x3 cell array
, \- o2 G3 @* K! n4 [! `0 o# k    {'c'}    {'b'}    {'a'}$ o  Y7 j5 C( x( h
    {'f'}    {'e'}    {'d'}0 Z3 B  a! W7 J- Y4 X
    {'i'}    {'h'}    {'g'}6 C- d* N- y) [  c' j& Q

7 ^9 a( o% O- r- {The order of the first and third columns of A is switched in B, while the second column remains unchanged.
* L# A( d$ C) m" E; [0 }0 f$ v& L
9 ?# B! U$ C6 @, h
+ {5 z0 k" l8 l' lFlip Multidimensional Array+ l) I) T- U( I: z. v  P( g2 y9 k

1 b; `  i; N, O5 i& X. y0 FCreate a multidimensional array.1 B5 q% i+ Q2 d9 }
  B4 l: k$ S) W' l/ N  y
A = cat(3, [1 2; 3 4], [5 6; 7 8])  _  s" o' a% v% T" L
, x% }: t$ m& t! B# A! R
A = . f+ `" j( R; l: b  i1 V7 d" ?
A(:,:,1) =
/ o, b+ k/ Y) n7 C8 [8 P
4 Q5 H. L( H+ M% C9 H  d- L. J     1     2: B0 I, F1 W8 D' X9 R! [1 d9 L: `
     3     4; h6 {  @3 N+ f3 S( r
/ B0 U0 O! a5 G/ p
+ E! H4 `4 L, O0 a" L! Y, |  B* A
A(:,:,2) =% S  G' Z: _! D2 }, C7 y! V% `4 d
/ E! A8 F. t% q9 L$ ^
     5     6
6 t2 B( q& T( G* P! G' H     7     8
0 x, k5 F5 h; r2 ~
+ g/ s% R, |: L- }A is an array of size 2-by-2-by-2.
' L# b2 ^& L4 N# D7 `- o% N" J: O6 A. ]) q/ D2 }  F
Flip the elements on each page of A in the horizontal direction.9 [4 i0 [# B! Z& \% c

) _. B8 y% G) D( SB = fliplr(A)
  t- P1 P2 M! q/ N1 ^" c3 f: |2 {7 _" c2 N
B = 4 E; {' u/ l) }/ s3 B$ n0 E$ H/ Q
B(:,:,1) =
0 c  |  r& G& e( {( |+ a
6 N% j+ v) q% G3 O/ \( k/ k     2     1  f! z; v/ y( m: e" D% O7 ?8 Z+ g3 B
     4     3+ m# P/ l5 n# ?( |; \; q; {
, y6 I% {5 v3 f7 Y

4 I4 [6 m" A/ z" }B(:,:,2) =  c- f2 r; q/ _) d4 J# }# J
% z6 J, m' @) |
     6     55 {: p5 V) \0 [* P
     8     7& l, G/ U' z" o8 Y

, X5 t8 I; b; a; r4 o" o6 w' J2 Z结果 B 与 A 的大小相同, 但元素的水平顺序被翻转。操作会单独翻转每个页面上的元素。
. L/ B3 d8 F- q8 x4 T. I% ~
: f' |0 ?. }4 Y& E4 E
( T) S' y2 B" i$ Y8 b5 o

该用户从未签到

2#
发表于 2020-1-8 19:15 | 只看该作者
MATLAB的fliplr 函数学习

该用户从未签到

3#
发表于 2020-1-9 19:01 | 只看该作者
MATLAB的fliplr 函数学习
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

推荐内容上一条 /1 下一条

EDA365公众号

关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

GMT+8, 2025-11-23 22:55 , Processed in 0.156250 second(s), 24 queries , Gzip On.

深圳市墨知创新科技有限公司

地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

快速回复 返回顶部 返回列表