MATLAB黑洞变量 [英] MATLAB black hole variable
本文介绍了MATLAB黑洞变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
MATLAB是否有黑洞"或丢弃变量?
Does MATLAB have a "blackhole" or discard variable?
说我正在做类似的事情:
Say I'm doing something like:
[ rows cols ] = size( A ) ;
但是我不希望存储行.是否有一个黑洞"变量,我可以在其中发送值以使其消失?
But I don't want rows to be stored. Is there a "black hole" variable where I can send values to die?
所以分配就像
[ BLACKHOLE, cols ] = size( A ) ;
BLACKHOLE意味着丢弃该值并且不为其创建变量.
Where BLACKHOLE means throw the value away and don't create a variable for it.
推荐答案
对于2009b或更高版本,使用代字号〜"
For 2009b or later, there is the tilde sign "~"
[~,cols] = size(A);
或者,根据您的具体情况
Alternatively, in your specific case
cols = size(A,2);
这篇关于MATLAB黑洞变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文