MATLAB Answers

D.J
0

Question re symbol ~

Asked by D.J
on 14 Sep 2018
Latest activity Commented on by Greg
on 15 Sep 2018
Hello, Can someone please explain what does (~) mean in the following code:
[num,~,raw] = xlsread(fname)
This is basically used to load xls files I know that ~ in general means (not) but I don't understand what it means here!
Many thanks Dima

  0 Comments

Sign in to comment.

Tags

1 Answer

Greg
Answer by Greg
on 14 Sep 2018
Edited by Greg
on 14 Sep 2018
 Accepted Answer

According to the documentation for Function Inputs and Function Outputs, the tilde simply means "ignore" input or output. It is helpful when you want the first and third outputs, but not the second, from a function. Using tilde tells MATLAB not to waste memory in your workspace by keeping that variable.
In your specific case, xlsread returns 3 outputs: the numbers, the non-digit text, and the raw information (numbers and text combined in one cell array). The author of your example line of code is saying "I don't care about the text output variable." Either because it will not be used at all, or because it will be extracted from the raw.

  2 Comments

D.J
on 14 Sep 2018
Great ! Thank you so much Greg !
Greg
on 15 Sep 2018
Happy to help.

Sign in to comment.