Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

"if (x==1 && y==0)" in Matlab

Status
Not open for further replies.

davyzhu

Advanced Member level 1
Joined
May 23, 2004
Messages
494
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,298
Location
oriental
Activity points
4,436
Hello all,

How to do "if (x==1 && y==0)" in Matlab, the "if (x==1 && y==0)" is in C. Thanks!

Davy
 

cedance

Advanced Member level 2
Joined
Oct 24, 2003
Messages
551
Helped
30
Reputation
60
Reaction score
7
Trophy points
1,298
Location
Germany
Activity points
4,622
hi,

see the matlab documentation..

u could see the matlab help for these sort of things.. or type "help if" in the command window and u would get it known from there...

nyways, the command is,
if ( a ==b & c ==d )
command........
end

also see here:
/http://www-ccs.ucsd.edu/matlab/techdoc/ref/if.html

/cedance
 

    davyzhu

    points: 2
    Helpful Answer Positive Rating

Element_115

Advanced Member level 2
Joined
Mar 23, 2002
Messages
509
Helped
72
Reputation
144
Reaction score
43
Trophy points
1,308
Activity points
3,767
In Matlab always use the help command it's a good tool to have!
help if
help &

This should help you in the future! As for you question.

if (x==1 & y==0);

That works

Peace
 

    davyzhu

    points: 2
    Helpful Answer Positive Rating

btwang

Newbie level 5
Joined
Mar 10, 2005
Messages
9
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,346
it should be "if(x==1&y==0)"in matlab
 

YUV

Advanced Member level 4
Joined
Sep 26, 2002
Messages
114
Helped
12
Reputation
24
Reaction score
3
Trophy points
1,298
Location
Ukraine
Activity points
1,191
davyzhu said:
Hello all,
How to do "if (x==1 && y==0)" in Matlab, the "if (x==1 && y==0)" is in C. Thanks!
Davy
If I were you, I would add extra round brackets
if ((x==1) & (y==0))
to be sure in order of operations. Also, it's much better readable.
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top