Why do I get this error since there is only one function?

조회 수: 1 (최근 30일)
Stelios Fanourakis
Stelios Fanourakis 2019년 6월 20일
답변: Walter Roberson 2019년 6월 20일
Hello
I get the below error
Error: File: SegmentBone.m Line: 7 Column: 18
Function with duplicate name "SegmentBone" cannot be defined.
If I use
which SegmentBone
It will give me the correct function "SegmentBone.m" in the working folder. There is no other function having exactly the same name. There are other functions with the name "SegmentBoneDP.mexmaci64" for instance or "SegmentBoneDP.cpp"
But their names are not identical. Thus, they are considered different names. Why do I get the error then?
  댓글 수: 1
KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 6월 20일
편집: KALYAN ACHARJYA 2019년 6월 20일
Change the funtion file name (function name and file name), still same issue, let us know.
Then share the SegmentBone.m function file and main code, where you call the function.

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

채택된 답변

Walter Roberson
Walter Roberson 2019년 6월 20일
This happens when a script file with that name contains a function definition with the same name. Which can also happen in what you thought was just a function definition file if you accidentally put commands before the function, such as accidental typing or such as a clc or clear statement.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by