필터 지우기
필터 지우기

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 CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by