if statements, setting large numbers

I have set up a function where I get a vectors size returned in [a b] format. Now I want to be able to set up a test in the form of an if statement, where if a>5 and b<5 I get back true. Any advice? Thanks!

回答 (1 件)

per isakson
per isakson 2015 年 5 月 25 日
編集済み: per isakson 2015 年 5 月 25 日

0 投票

The matlabish way:
>> test = @(a,b) ( a>5 & b<5 );
>> test( [1;6],[6;1] )
ans =
0
1
>> test(6,6)
ans =
0
>> test(6,4)
ans =
1
>> test( [2:7],[7:-1,2] )
ans =
0 0 0 0 1 1
Why does the title contain "setting large numbers"?

カテゴリ

ヘルプ センター および File ExchangeInstrument Control Toolbox についてさらに検索

タグ

質問済み:

2015 年 5 月 25 日

コメント済み:

2015 年 5 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by