How to write a function which handles strings?

5 ビュー (過去 30 日間)
Lihini see
Lihini see 2020 年 5 月 6 日
コメント済み: Lihini see 2020 年 5 月 6 日
I need to write a simle function which uses strings as inputs.
As a example:
a= writes('hello')
function result = writes(words)
result=words
end
it produce a error " Undefined function 'writes' for input argument type 'char' "
I'm using live editor in matlab 2016.
help. Thanks
  1 件のコメント
Rik
Rik 2020 年 5 月 6 日
There is no fundamental problem with your syntax, so the only possibility is that Matlab can't find your function.

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

採用された回答

Sindar
Sindar 2020 年 5 月 6 日
Live editor functionality changes a lot across versions, but my suggestion would be to put your function in a separate cell from the call, and make sure the function cell gets evaluated before the call line.
  1 件のコメント
Lihini see
Lihini see 2020 年 5 月 6 日
I will do that.
Thank you for your help

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by