norm inbuilt function code

조회 수: 3 (최근 30일)
Francesco Fortunato
Francesco Fortunato 2018년 4월 10일
편집: Walter Roberson 2018년 4월 10일
I am trying to find the code for the inbuilt function norm, but, by typing "open norm" I would only find a script describing it, not the code. I need to write the m file as funtion in order to add it in my folder with the other functions (for instance deg2rad which is another but its code is aveilable by typing "open deg2rad")

채택된 답변

dpb
dpb 2018년 4월 10일
That's how all builtin functions work in Matlab, that's why they're "built in"; the working part of the function is compiled code built into the executable for the program. Core functionality is incorporated in that manner to improve performance; other routines are just supplied m-code no different than user-written as far as their implementation. There are also p-code and mex files...
Why do you think you need to include the function in some other location; there really is no reason to do that in general. Occasionally one will take a specific m-file and create a slightly modified version for a specific purpose, but it's highly recommended to make the user copy distinct and to not modify nor alias actual distributed functions.
  댓글 수: 6
Guillaume
Guillaume 2018년 4월 10일
You focused on the wrong part of the error message. It's not that it's undefined, it's that it's not defined for inputs of type matlab.ui.container.Menu. Indeed, what do you expect the norm of a menu to be?
Clearly the problem is not with norm, the problem is with the line
if ~norm(childrens)
which makes no sense.
dpb
dpb 2018년 4월 10일
As James surmised, it's not that the code for norm is missing; it's that you're calling it with something other than a numeric input...read the message carefully:
Undefined function 'norm' for input arguments of type 'matlab.ui.container.Menu'.
You've got to dereference the GUI object to get the content thereof; I'm no GUI kinda' guy to even have a clue what a matlab.ui.container is or would look like, but certainly a Menu of one won't be anything meaningful to take the norm of...

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by