Filtering Data between two user inputted Values

조회 수: 13 (최근 30일)
William Harris
William Harris 2020년 4월 1일
편집: Ameer Hamza 2020년 4월 1일
I have 22483 % 6 x 3 Matrix, I am trying to filter this data between two user inputted values using the prompt 'inputdlg'. I want this to create a new column matrix which i can then plot. At the moment the Find operation isnt working, it either returns an error or just outputs the same values without any filtering.
prompt = {'Enter Eastings Upper Bound:','Enter Easting Lower Bound:','Enter Northings Upper Bound:','Enter Northings Lower Bound:'};
dlgtitle = 'Input must be within array dimensions';
dims = [1 35];
definput = {'300000','inf','0','inf'};
bounds = inputdlg(prompt,dlgtitle,dims,definput);
%bounds prompt
Users_Input=str2double(bounds)
%converting bounds into matrix
Eastings_Upper_Bound=Users_Input(1,:);
Eastings_Lower_Bound=Users_Input(2,:);
Northings_Upper_Bound=Users_Input(3,:);
Nothings_Lower_Bound=Users_Input(4,:);
find(Easting_Data(Easting_Data>'Eastings_Lower_Bound' & Easting_Data<'Eastings_Upper_Bound'))

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 4월 1일
편집: Ameer Hamza 2020년 4월 1일
You are referring to variable names as character array. Correct is
find(Easting_Data(Easting_Data>Eastings_Lower_Bound & Easting_Data<Eastings_Upper_Bound))
% ^ no ' ' here

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by