What does this statement mean???
[M N ~] = size(imge);
I don't understand the reason to use this "~", and this statement also gives an error message.
In MATLAB versions since 2009b, you can use the tilde (~
) to ignore outputs which you don't need. If it gives you an error, that means your version doesn't support this use of the tilde and you have to replace it with a dummy variable name as so:
[M N dummy] = size(imge);
As Sumona explains, M will contain the number or rows in the image and N the number of columns; dummy will be 1 (for one black-and-white image), 3 (for one colour image) or an arbitrary integer (for an image stack).
Usually it only makes sense to use the tilde if there are other parameters you are interested afterwards. size
is an exception here in that it checks (using nargout
) how many outputs it should produce and changes its behavior accordingly, as documented here..
That is,
test = zeros(3,4,5);
[M N dummy] = size(test);
produces M=3,N=4 as one would expect, but
test = zeros(3,4,5);
[M N] = size(test);
produces M=3,N=20.
In your particular case, I assume imge
is an image stack and the programmer wanted to find out the size of the individual images, but not how many there are.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With