What does '& ...' mean in Matlab?

7 views (last 30 days)
JFz
JFz on 9 Jul 2015
Commented: Stephen23 on 10 Jul 2015
I am new here and I don't know this expression: '& ...'. Can anyone explain?
I googled it but could not find an answer. Thanks.
Jennifer

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 9 Jul 2015
Edited: James Tursa on 9 Jul 2015
&... is not an expression. & can be used as logical "and" operator
Example
a=10
b=20
a==10 & b==2
is equivalent to
and(a==10,b==2)
$ can be used otherwise in different situations
  1 Comment
Stephen23
Stephen23 on 10 Jul 2015
Image Analyst gives the correct answer below.

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 9 Jul 2015
You didn't give the whole line but my guess is that someone is doing a logical operation and is using ... to continue the operation on the next line. For example instead of doing
results = thisVariable & thatVariable;
they're putting it on 2 lines like this:
results = thisVariable & ...
thatVariable;
That's just a guess, Jennifer, as to what it could be. I can't know for sure because you forgot to include the line(s) of code.
  2 Comments
JFz
JFz on 10 Jul 2015
Thank you!. Your answer is the right answer too. How can I mark it as the accepted answer?
Image Analyst
Image Analyst on 10 Jul 2015
Jennifer, once an answer has been accepted, there is no way to unaccept it. However, you can still "Vote" for Answers to give the person credit (reputation points) for giving a correct answer. Thanks!

Sign in to comment.

Categories

Find more on Particle & Nuclear Physics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!