필터 지우기
필터 지우기

How to check whether variables lie with in the region?

조회 수: 1 (최근 30일)
Matt Learner
Matt Learner 2012년 3월 23일
I have two variables x1 and x2. Both variables have certain range i.e., x1_min<=x1<=x1_max and x2_min<=x2<=x2_max. I have to check if x1 and x2 are with in the limits and if it lies within the limits, then execute a statement. I am using one method as if (x1<=x1_max && x1>=x1_min) if (x2<=x2_max && x2>=x2_min) statement end end But what if i have more variables, say 10, then i cannot use this method as it is tedious process and not a good approach. So Please let me know the solution for this issue.

채택된 답변

Sean de Wolski
Sean de Wolski 2012년 3월 23일
Don't use 10 variables, use 1-1x10 vector:
The function all might be your friend as well:
doc all
  댓글 수: 1
Matt Learner
Matt Learner 2012년 3월 26일
I didn't understand your answer of using vector and function "all", correctly. Can you please show me how to use it for my question above?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Argument Definitions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by