方括号中的波浪号 [英] Tilde character in the brackets

查看:112
本文介绍了方括号中的波浪号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MATLAB中,以下代码做什么:

In MATLAB, what does the following code do:

[m, ~]=func_returning_matrix()

代字号运算符〜,做什么?

What does the tilde operator, ~, do?

推荐答案

在Matlab中,这意味着不要在分配的rhs中分配该函数的相应输出参数.因此,如果func_returning_matrix返回2个参数,则表达式会将第一个分配给变量m,而忘记第二个.如果func_returning_matrix返回3个(或更多)参数,则该表达式将删除该函数的第二个以及所有以后的输出.

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.

这篇关于方括号中的波浪号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆