why vectorize function is not recommended?

22 ビュー (過去 30 日間)
Osama Alkurdi
Osama Alkurdi 2021 年 1 月 28 日
編集済み: Stephen23 2024 年 11 月 15 日 6:36
can anyone explain to me in a simple way why vectorize function is not recommended, and how i can avoid any possible troubles from using it
and is there is a better way to do its functionality, please dont give me links, just explain to me in a simple way, thanks in advance.
  12 件のコメント
Walter Roberson
Walter Roberson 2021 年 1 月 28 日
Also, long standing bug: vectorize changes quoted strings.
vectorize("ismember(A, {'+', '-', '*', '/', '^', '\'})")
ans = 'ismember(A, {'+', '-', '.*', './', '.^', '\'})'
Stephen23
Stephen23 2021 年 1 月 29 日
編集済み: Stephen23 2024 年 11 月 15 日 6:36
"You missed one, Stephen, but it is quite obscure. The \ operator is vectorized as .\ also known as ldivide; "
No, as your own example clearly shows VECTORIZE() does not change that operator:
vectorize('a\b')
ans = 'a\b'
I did not "miss" that operator, because what I wrote replicates the behavior of VECTORIZE().

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

回答 (1 件)

Catalytic
Catalytic 2021 年 1 月 29 日
A warning without an explanation is not a real warning. I say you just ignore it.
  4 件のコメント
Matt J
Matt J 2021 年 1 月 29 日
If no explanation implies the reason doesn't exist then, by the same logic, no explanation for the omission means the omission doesn't exist. So if the omission doesn't exist, maybe TMW feels than explanation was indeed given! :-)
Adam Danz
Adam Danz 2021 年 1 月 29 日
編集済み: Adam Danz 2021 年 1 月 29 日
Scroll to the bottom of the vectorize page and place a star rating which will allow you to type and submit feedback.
That feedback is received by MathWorks Gnomes which are never seen nor heard but visit the MathWorks documentation team at night while they are sleeping and whisper selected suggestions into their ears to manipulate their dreams. Occassionally this causes them to wake up with a Eureka moment that leads to changes in the documentation.

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by