Could I name a function "SPHERE" without conflict with the built-in function "sphere"?

6 ビュー (過去 30 日間)
Robert Gragg
Robert Gragg 2016 年 9 月 6 日
回答済み: Adam 2016 年 9 月 7 日
"help SPHERE" and "help sphere" produce the same result. Does that mean that Matlab doesn't distinguish between the two?

採用された回答

José-Luis
José-Luis 2016 年 9 月 7 日
The answer for the rules on case sensitivity is: it depends.

その他の回答 (1 件)

Adam
Adam 2016 年 9 月 7 日
Yes, you can. To be honest though you could have tested this in less time than it took to ask the question! (Assuming you are familiar with the 'which' function which you should always make use of when you are not sure if you are about to conflict with an existing function name).
I just created a new function called SPHERE and ran the following:
>> which SPHERE
D:\MatlabDev\SPHERE.m
>> which sphere
C:\Program Files\MATLAB\R2016a\toolbox\matlab\specgraph\sphere.m
so both are recognised independently of each other. Calling them both also confirms this.

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by