How can I configure , so that MATLAB will not allow duplicate built in function by re-definition ?
조회 수: 4 (최근 30일)
이전 댓글 표시
MATLAB(7.5.0) has some built in functions when some body is Overwriting it by another defination in Matlab Command Window, it is allowing and meaning is changing, Somecases it is giving absurd result & some cases it is giving errors for Overwrite.
for Example:
>> M = magic(3)
M =
8 1 6
3 5 7
4 9 2
>> result = -det(M)
result =
360
>> det =1
det =
1
>> result= -det(M)
??? Index exceeds matrix dimensions.
MATLAB(7.5.0) has some built in functions when some body is Overwriting it by another defination in Matlab Command Window, it is allowing and meaning is changing, Somecases it is giving absurd result & some cases it is giving errors for Overwrite.
댓글 수: 0
채택된 답변
Image Analyst
2013년 2월 7일
I don't know that you can prevent it. Sometimes (rarely) this is exactly what you do want to do. You can make a habit of doing a dependency report and looking it over to see anything that looks like it might be using the wrong function.
추가 답변 (1개)
Azzi Abdelmalek
2013년 2월 7일
편집: Azzi Abdelmalek
2013년 2월 7일
det is a Matlab function. when you do
det=1
you are creating a new variable det, and shadows the function det. To restore it
clear det
det(M)
댓글 수: 6
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!