How to flip the individual elements in an array

조회 수: 3 (최근 30일)
Hari
Hari 2016년 11월 17일
댓글: Hari 2016년 11월 17일
I have a 3 x 1 cell array:
[1,2,5]
[1,2,4,5]
[1,2,3,6,15,7]
Is there a way to form a new cell array which includes these elements as well as their flipped ones,like this:
[1,2,5]
[1,2,4,5]
[1,2,3,6,15,7]
[5,2,1]
[5,4,2,1]
[7,15,6,3,2,1]

채택된 답변

KSSV
KSSV 2016년 11월 17일
편집: KSSV 2016년 11월 17일
doc fliplr
c = {[1,2,5]
[1,2,4,5]
[1,2,3,6,15,7]} ;
% reverse the arrays
c1 = cellfun(@fliplr,c,'un',0) ;
iwant = [c ; c1] ;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by