Question on error obtained
이전 댓글 표시
I am getting the following error...
Error: File: sub_map_ar_3.m Line: 2 Column: 37
Function with duplicate name "sub_map_ar_3" cannot be defined.
Error in HazKTM_3atn_final (line 185)
[az,bz,am,amy,nats,natp]=sub_map_ar_3(slon,elon,slat,elat,dmg,dt,xmin, ...
What could be the reason for this type of error???
답변 (2개)
madhan ravi
2018년 12월 30일
Just rename the function name so that you don’t get the error again.
which sub_map_ar_3 -all % will show you the existing files with the name
Walter Roberson
2018년 12월 30일
0 개 추천
Your sub_map_ar_3.m contains an executable line in the first line, followed by a function definition for sub_map_ar_3 on the second line. The executable line makes it into a script file instead of a function file. When you have a script file that contains a function (which is permitted from R2016b onwards) then the function defined inside the file cannot have the same name as the script file.
You should check the first line of your sub_map_ar_3.m to see whether you accidentally inserted some text. If you put something like "clear all" in at the top of the file, that should definitely be removed.
카테고리
도움말 센터 및 File Exchange에서 Seismology에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!