What does the ~ and | mean in the following code?

Hello,
I've got the following code, that should write CNTLON to the com port to a robotic arm with the mmPrintf function. The mmScanf reads the response of the robot. What does the ~ and the | mean?
r1 = mmPrintf(robot, 'CNTLON'); [~, r2] = mmScanf(robot); r = r1 | r2;
Thanks!

Respuestas (2)

Star Strider
Star Strider el 4 de Mayo de 2014

3 votos

The tilde (~) means that mmScanf(robot) should not return whatever the value is for the first output. The following code apparently doesn’t use it.
The bar () is the logical ‘or’. In this case, |r becomes either r1 or r2.
Jos (10584)
Jos (10584) el 4 de Mayo de 2014
take a look at this example
A = 1:10
q = A < 4
p = A < 7
np = ~p
r = q | np
B = A(r)
help not
help or

Categorías

Más información sobre ROS Toolbox en Centro de ayuda y File Exchange.

Preguntada:

Wim
el 4 de Mayo de 2014

Respondida:

el 4 de Mayo de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by