Writing commands in MATLAB

4 ビュー (過去 30 日間)
Ondrej
Ondrej 2022 年 10 月 15 日
回答済み: Maria Ghani 2022 年 10 月 19 日
Hello, I have just little question. Im used to write commands in Caps Lock all the time. Is there any chance I can allow it in Preferences window? Or in some Settings?
For example I have command rand > RAND , ans > ANS , sin > SIN , sort > SORT, who > WHO , etc etc...
I hope you get my point.

回答 (2 件)

Jan
Jan 2022 年 10 月 15 日
編集済み: Jan 2022 年 10 月 15 日
No, this will not work.
Since R2009a Matlab is case-sensitive even under Windows. You cannot call sin() using the name SIN(). But you could write a wrapper function:
function y = SIN(x)
y = sin(x);
end
But this will slow down the processing and increase the confusion level. You cannot share your code afterwards and a collaboration with others requires, that they obtain a bunch of useless functions from you.
Functions with a variable number of inputs and outputs need more code.
Avoid such clutter.
By the way, ans is not a function. It stores the last replied value of commands, which are not caught in an output. Avoid to use it in productive code, because it is too volatile. During debugging ans can be overwritten and everything, which impedes debugging is the enemy of the programmer.
  1 件のコメント
Ondrej
Ondrej 2022 年 10 月 15 日
Okay thank you :)

サインインしてコメントする。


Maria Ghani
Maria Ghani 2022 年 10 月 19 日
i need to run regression to get coeffecient between two variables x, y . my data set is daily from 1995 to 2022 . i need monthly coeffecient between two variables . what command should i need to write please anyone help. my dat afile is attached for detail information. x regress y but how i can get for every month ?
thanks in advance

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by