Tilde character in the brackets

前端 未结 1 910
梦如初夏
梦如初夏 2020-12-02 02:17

In MATLAB, what does the following code do:

[m, ~]=func_returning_matrix()

What does the tilde operator, ~, do?

相关标签:
1条回答
  • 2020-12-02 02:56

    In Matlab it means don't assign the corresponding output argument(s) from the function on the rhs of the assignment. So, if func_returning_matrix returns 2 arguments, the expression will assign the first to the variable m and forget the second. If func_returning_matrix returns 3 (or more) arguments, then the expression will drop the second and all later outputs from the function.

    0 讨论(0)
提交回复
热议问题