create tuples of values in array

first of all thanks for help :-|)
how can i compression two matrixes
for example
X=[x1,x2,x3,..,xn];
Y=[y1,y2,y3,..,yn];
in one matrix by a way that each element in X array make groupe with the corresponding from the Y matrix as
xy=[(x1,y1),(x2,y2),(x3,y3),..,(xn,yn)];
and how we can sort it agine to
X=[x1,x2,x3,..,xn];
Y=[y1,y2,y3,..,yn];

回答 (1 件)

Alan Stevens
Alan Stevens 2020 年 11 月 22 日
編集済み: Alan Stevens 2020 年 11 月 22 日

0 投票

How about
x=[x1,x2,x3,..,xn];
y=[y1,y2,y3,..,yn];
xy = [x; y];
X = xy(1,:);
Y = xy(2,:);

1 件のコメント

ahmed noori
ahmed noori 2020 年 11 月 22 日
編集済み: ahmed noori 2020 年 11 月 22 日
very useful thak you so much but not works with two dimensional matrix

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeData Types についてさらに検索

質問済み:

2020 年 11 月 22 日

編集済み:

2020 年 11 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by