MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodayTo resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Asked by Tom Wetherill on 28 Mar 2013

I have a large amount of data that i need to process with Matlab but am quite a novice so unfamiliar with all but the basics. I effectively have a large data file containing thousands of entries and i need to know how i can remove a number of specific rows depending on the corresponding value if that makes any sense at all.

Column A is made up of depth values that range from .0000 to 2000.0000m and column B contains salinity values corresponding with each of these depths for a number of stations over a number of years. I want to find if i can remove all values from column B that correspond with values in column A that are less then or equal to 120.0000m.

If(A<=120.0000 then delete B)

I tried to convey this as best as i could in the expression above but don't know where to start with actual equations so any help would be much appreciated.

*No products are associated with this question.*

Answer by Wayne King on 28 Mar 2013

Edited by Wayne King on 28 Mar 2013

Accepted answer

Assume X is your data matrix,

Xnew = X(X(:,1)>120,:);

So for example:

X = randi(10,10,2); Xnew = X(X(:,1)>6,:);

I'm assuming that by column A you mean the 1st column of the matrix.

## 1 Comment

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/68979#comment_139604

The data is that the content of a file or the value of a variable?