필터 지우기
필터 지우기

Why are the results of the size function different from the whos function Size?

조회 수: 2 (최근 30일)
Why are the results of the size function different from the whos function Size?
Here is an example:
>> excelstring = strfind('ABC DUMP.txt','.xls')
excelstring =
[]
>> size excelstring
ans =
1 11
>> whos excelstring Name Size Bytes Class Attributes
excelstring 0x0 0 double

채택된 답변

James Tursa
James Tursa 2011년 6월 15일
Doing this:
size excelstring
Is equivalent to doing this:
size('excelstring')
Whenever you invoke a function without the parens, the remainder of your inputs are taken to be literal string(s).
  댓글 수: 1
Matt Fig
Matt Fig 2011년 6월 15일
As described here:
http://www.mathworks.com/help/techdoc/ref/syntax.html
This is called command-function duality.

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

추가 답변 (1개)

the cyclist
the cyclist 2011년 6월 15일
Because the syntax for what you wanted is
>> size(excelstring)
Looks like your syntax is giving the size of the string 'excelstring', rather than that of the variable named excelstring.
  댓글 수: 1
Chirag Gupta
Chirag Gupta 2011년 6월 15일
To explain further, size excelstring is equivalent to asking MATLAB to compute size('excelstring').
MATLAB takes the arguments as strings if they are not passed in parenthesis ()

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

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by