Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics 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.

"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
 

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
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
it should be "if(x==1&y==0)"in matlab
 

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top