Creating a two matrices from 2 existing matrices according to a rule
3 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
I am new to matlab and I have been trying to create a rule for the past couple of days, unfortunately unsuccessful I hope that someone here would be able to help me.
Here is the problem:
I have two matrices Y ( 1 column vector with 10 000 entries) and X (matrix with 4 columns, 10 000 entries in each). I want to create new matrix Y and X according to the following rule, Matrix X should contain the same 4 columns but only 50 observations, and the rule: it should contain the first 50 observations in absolute value from column 3 and the corresponding elements (to the observations in column 3) from column 1, 2 and 4. It should take also the corresponding elements of vector Y to the first 50 observations in absolute value in column 3 of X. And it should save them in new matrices Y1 and X1. And here is the most challenging part: It should do this 200 times increasing the number of observations each time by 50 (meaning the first 50 in absolute value in column 3 in X + the second 50 in absolute value in column X, etc.)
I am really puzzled how to do this and I hope somebody can help me.
Thank you all for your help and time!
1 件のコメント
採用された回答
Image Analyst
2012 年 5 月 12 日
What does this mean: "the first 50 observations in absolute value"? Do you mean that you just simply take the absolute value of the column 3, like this:
first50Col3Values = abs(X(1:50, 3));
and I don't understand your most challenging part, aren't you simply taking abs(X(51:100, 3)), abs(X(101:150, 3)) and so on, two hundred times? What's so hard about that?
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!