find x subjected to some limit.

조회 수: 1 (최근 30일)
Andrea
Andrea 2012년 5월 30일
I want to to find a<=x<b and c<=y<d in a matrix. But simply I can't. I would appreciate if you help me.

채택된 답변

Thomas
Thomas 2012년 5월 30일
This might be what you need
q=rand(3,3); % generate 3x3 random matrix
a=0.1; b=0.3; c=0.5;d=0.9; %values of a b c and d
x=q(q>a&q<b) % to find value greater than a and less than b in matrix q
y=q(q>c&q<d) % to find value greater than c and less than d in matrix q
  댓글 수: 1
Andrea
Andrea 2012년 5월 30일
Thanks, but more specifically I want to have some part of q that has (x=>a&x<b &y=>c&y<d). I mean each array in q has an x and y, so I want to select q according to (x=>a&x<b &y=>c&y<d) and put them in a new matrix. Would you please help me?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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