Check for missing argument or incorrect argument data type in call to function 'new'.

조회 수: 29 (최근 30일)
I could not find the answer. I am missing something

답변 (1개)

Reshma Nerella
Reshma Nerella 2021년 4월 5일
Hi,
The reason behind the error is that,
You are using 2 different names for function name and file name i.e new and Ve.
In MATLAB, if the function has only one function definition, the name of the file must match the name of the function.
So consider either of the following
  1. Naming your file to new
  2. Naming your function to Ve
To know more about functions, refer to the documenation page: functions
  댓글 수: 2
Walter Roberson
Walter Roberson 2021년 4월 5일
Not exactly, but related.
MATLAB has function files (first word is "function"), and class definition files (first word is "classdef") and script files (all other matlab source code.)
Function files have a file name, and can contain multiple functions. However the first function in the file will be known by the file name no matter what (valid) name is present in the file definition. This is true both for calling from inside the file and for calling from outside the file.
The user might have tried to call new() from outside the file Ve.m expecting that matlab would find new() inside Ve. However matlab would know that function as Ve, and so if the user tried to call new() it would have been some other new() that was called.

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

카테고리

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