Question re symbol ~

조회 수: 4 (최근 30일)
D.J
D.J 2018년 9월 14일
댓글: Greg 2018년 9월 15일
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

채택된 답변

Greg
Greg 2018년 9월 14일
편집: Greg 2018년 9월 14일
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
D.J
D.J 2018년 9월 14일
Great ! Thank you so much Greg !
Greg
Greg 2018년 9월 15일
Happy to help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by