フィルターのクリア

variable positions in matrix

1 回表示 (過去 30 日間)
Linden
Linden 2014 年 5 月 6 日
回答済み: Image Analyst 2014 年 5 月 6 日
Hi Is it possible to easily switch the variable positions in a matirx. For example, I have 4 time series variables, x1, x2, x3 and x4. They form a matrix [x1 x2 x3 x4]. In my program, I want to give an indix that to each of these variables such that if I put 2 1 3 4, the matrix will become [x2 x1 x3 x4]. Many thanks

回答 (1 件)

Image Analyst
Image Analyst 2014 年 5 月 6 日
I think you just did it, didn't you? If you want and just have an array x, you can do
new_x = [x(:,2), x(:, 1), x(:, 3), x(:, 4)];

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by