Search code examples
matlabfunction-handle

significance of ~ symbol in matlab function


If I have a function a that accepts 2 parameters (double) in Matlab as follows

function [x,y] = a(z)

What does the symbol "~" do when the function is called with this handle as follows

[x,~,y] = a[10]

Thanks


Solution

  • The "~" symbol in matlab is logical NOT. So it's basically like ignoring that output/input. For example, if I have a line of code like this:

    [out1,~,out3] = function(vargin);

    the second output is not kept or stored anywhere for later use. For more info, type "help ~" in the command window.