Need some help setting up a function for elementary data filtering

Hi,
I have imported a data array (Araw) that has a couple thousand rows and 17 columns (50Hz data - each column represents a monitored variable). These are the tasks I am required to perform with Matlab:
  • Absolute value all values in column 7
  • Remove all rows of data where values in column 8 are >=0
  • Absolute value all remaining values in column 8
  • Rename the new array "A"
I'm relatively new at programming with Matlab so any help/hints/tips are most appreciated.
Many thanks,
Riccardo

 採用された回答

Oleg Komarov
Oleg Komarov 2011 年 7 月 26 日

0 投票

1. abs(A(:,7))
2. idx = A(:,8)>= 0; A = A(~idx,:);
Last two up to you.

その他の回答 (1 件)

Honglei Chen
Honglei Chen 2011 年 7 月 26 日

0 投票

You can use logical index to do this. For example, to achieve the first task, you can do something like
x = ones(5,4);
x(:,2) = abs(x(:,2))
You can also try the following code and see what happens
x = ones(5,4);
x(3,:) = []
HTH

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by