Error with size( )

조회 수: 3 (최근 30일)
Swati Sarangi
Swati Sarangi 2020년 11월 10일
답변: Walter Roberson 2020년 11월 10일
Hi All,
I am stuck at a point in my code which shows error. The code snippet is as follows;
[ n, m]= size(x1)
so, when I type size(x1) in the command window, I get the answer as 1 3 , where as the above line throws an error stating "not enough input argument".
Can someone explain me about it?
Thanks in advance
Swati
  댓글 수: 1
KSSV
KSSV 2020년 11월 10일
Where did you type
[n,m] = size(x1) ;

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

답변 (2개)

Stephan
Stephan 2020년 11월 10일
편집: Stephan 2020년 11월 10일
size is an inbuilt function which uses at least on input argument. If you call the function without an input argument you end up with an error, because the function needs to know the array of that you want to know the size from the function.

Walter Roberson
Walter Roberson 2020년 11월 10일
You are running a function that has a parameter named x1, but you ran the function either by giving only its name at the command line, or by pressing the green Run button. You need to go down to the command line and invoke the function, passing in some appropriate parameter, such as
result = standard_deviation(rand(1,30))

카테고리

Help CenterFile Exchange에서 Parallel Computing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by