# MATLAB: Analysing data that meets conditions

discretisinglarge data

Hi all,
I am trying to analyse data from an FEM software. The data relates to node positions and then a velocity value [x,y,u].
I am trying to analyse sectors of the 2D domain which is 5000m x 2000m.
For each sector I want to analyse a 1m x 113m area and then average all the nodes within that sector to form an overall u.
I don't quite know how to tackle this problem, I have been trying for a few days and can't quite get the scripts to work.
I specifically want to know if it is possible to scan through data looking for specific nodes which are within (1 <= x <= 2),(10<=y<=123) and then average them and then start building up a library of u values for each sector.
I would greatly appreciate anyones input.
Kind Regards,
Christopher

idx=iswithin(data(:,1),1,2) & iswithin(data(:,2),10,123);  % select the condition; idx-->logicalmeans=mean(data(idx,:));        % average over each column of those values (*)
>> type iswithinfunction flg=iswithin(x,lo,hi)% returns T for values within range of input% SYNTAX:%  [log] = iswithin(x,lo,hi)%      returns T for x between lo and hi values, inclusiveflg= (x>=lo) & (x<=hi);